# Calling the centralization() function available in R and C igraph from Python igraph?

**URL:** <https://igraph.discourse.group/t/calling-the-centralization-function-available-in-r-and-c-igraph-from-python-igraph/1680>\
**Category:** Usage\
**Tags:** Python\
**Created:** [29 September 2023 13:30 UTC](https://igraph.discourse.group/t/calling-the-centralization-function-available-in-r-and-c-igraph-from-python-igraph/1680 "2023-09-29T13:30:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![john\_booth](https://avatars.discourse-cdn.com/v4/letter/j/ce73a5/32.png) [@john\_booth](https://igraph.discourse.group/u/john_booth)\
**Post date:** [29 September 2023 13:30 UTC](https://igraph.discourse.group/t/calling-the-centralization-function-available-in-r-and-c-igraph-from-python-igraph/1680/1 "2023-09-29T13:30:49Z")

</div>

I want to use the centralization function from the python igraph and it doesn’t appear to be available.

[https://igraph.org/c/doc/igraph-Structural.html#centralization](https://igraph.org/c/doc/igraph-Structural.html#centralization)

[https://igraph.org/r/doc/centralize.html](https://igraph.org/r/doc/centralize.html)

Is there a way of calling the C function from within the python API?

Or is there a way I can calculate the centralization myself?

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [29 September 2023 15:39 UTC](https://igraph.discourse.group/t/calling-the-centralization-function-available-in-r-and-c-igraph-from-python-igraph/1680/2 "2023-09-29T15:39:12Z")

</div>

> [@john\_booth](#):
>
> Is there a way of calling the C function from within the python API?

Not at the moment.

> [@john\_booth](#):
>
> Or is there a way I can calculate the centralization myself?

The definition, which is included in the R and C docs, is straightforward to implement as a one-liner, assuming you don’t want normalization.

If you do want normalization, look up what the most centralized structure is for different centralities in in the C docs, [igraph Reference Manual](https://igraph.org/c/html/latest/igraph-Structural.html#centralization). Then compute the unnormalized centralization for that structure, and use the result as the normalization factor.
