Skip to content

Commit 9bff9fa

Browse files
committed
Merge branch 'main' into develop
2 parents 9a3e610 + 5a29c79 commit 9bff9fa

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+472
-232
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,15 @@
639639
"contributions": [
640640
"code"
641641
]
642+
},
643+
{
644+
"login": "SKG24",
645+
"name": "Sanat Kumar Gupta",
646+
"avatar_url": "https://avatars.githubusercontent.com/u/123228827?v=4",
647+
"profile": "https://github.com/SKG24",
648+
"contributions": [
649+
"code"
650+
]
642651
}
643652
],
644653
"contributorsPerLine": 7

CONTRIBUTORS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
9797
<td align="center" valign="top" width="14.28%"><a href="https://github.com/GenieTim"><img src="https://avatars.githubusercontent.com/u/8596965?v=4?s=100" width="100px;" alt="Tim Bernhard"/><br /><sub><b>Tim Bernhard</b></sub></a><br /><a href="https://github.com/igraph/python-igraph/commits?author=GenieTim" title="Code">💻</a></td>
9898
<td align="center" valign="top" width="14.28%"><a href="https://github.com/BeaMarton13"><img src="https://avatars.githubusercontent.com/u/204701577?v=4?s=100" width="100px;" alt="Bea Márton"/><br /><sub><b>Bea Márton</b></sub></a><br /><a href="https://github.com/igraph/python-igraph/commits?author=BeaMarton13" title="Code">💻</a></td>
9999
</tr>
100+
<tr>
101+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/SKG24"><img src="https://avatars.githubusercontent.com/u/123228827?v=4?s=100" width="100px;" alt="Sanat Kumar Gupta"/><br /><sub><b>Sanat Kumar Gupta</b></sub></a><br /><a href="https://github.com/igraph/python-igraph/commits?author=SKG24" title="Code">💻</a></td>
102+
</tr>
100103
</tbody>
101104
</table>
102105

doc/examples_sphinx-gallery/articulation_points.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
This example shows how to compute and visualize the `articulation points <https://en.wikipedia.org/wiki/Biconnected_component>`_ in a graph using :meth:`igraph.GraphBase.articulation_points`. For an example on bridges instead, see :ref:`tutorials-bridges`.
99
1010
"""
11+
1112
import igraph as ig
1213
import matplotlib.pyplot as plt
1314

@@ -30,9 +31,9 @@
3031
vertex_size=30,
3132
vertex_color="lightblue",
3233
vertex_label=range(g.vcount()),
33-
vertex_frame_color = ["red" if v in articulation_points else "black" for v in g.vs],
34-
vertex_frame_width = [3 if v in articulation_points else 1 for v in g.vs],
34+
vertex_frame_color=["red" if v in articulation_points else "black" for v in g.vs],
35+
vertex_frame_width=[3 if v in articulation_points else 1 for v in g.vs],
3536
edge_width=0.8,
36-
edge_color='gray'
37+
edge_color="gray",
3738
)
3839
plt.show()

doc/examples_sphinx-gallery/betweenness.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
# :meth:`igraph.utils.rescale` to rescale the betweennesses in the interval
2525
# ``[0, 1]``.
2626
def plot_betweenness(g, vertex_betweenness, edge_betweenness, ax, cax1, cax2):
27-
'''Plot vertex/edge betweenness, with colorbars
27+
"""Plot vertex/edge betweenness, with colorbars
2828
2929
Args:
3030
g: the graph to plot.
3131
ax: the Axes for the graph
3232
cax1: the Axes for the vertex betweenness colorbar
3333
cax2: the Axes for the edge betweenness colorbar
34-
'''
34+
"""
3535

3636
# Rescale betweenness to be between 0.0 and 1.0
3737
scaled_vertex_betweenness = ig.rescale(vertex_betweenness, clamp=True)
@@ -45,7 +45,7 @@ def plot_betweenness(g, vertex_betweenness, edge_betweenness, ax, cax1, cax2):
4545

4646
# Plot graph
4747
g.vs["color"] = [cmap1(betweenness) for betweenness in scaled_vertex_betweenness]
48-
g.vs["size"] = ig.rescale(vertex_betweenness, (10, 50))
48+
g.vs["size"] = ig.rescale(vertex_betweenness, (10, 50))
4949
g.es["color"] = [cmap2(betweenness) for betweenness in scaled_edge_betweenness]
5050
g.es["width"] = ig.rescale(edge_betweenness, (0.5, 1.0))
5151
ig.plot(
@@ -58,8 +58,8 @@ def plot_betweenness(g, vertex_betweenness, edge_betweenness, ax, cax1, cax2):
5858
# Color bars
5959
norm1 = ScalarMappable(norm=Normalize(0, max(vertex_betweenness)), cmap=cmap1)
6060
norm2 = ScalarMappable(norm=Normalize(0, max(edge_betweenness)), cmap=cmap2)
61-
plt.colorbar(norm1, cax=cax1, orientation="horizontal", label='Vertex Betweenness')
62-
plt.colorbar(norm2, cax=cax2, orientation="horizontal", label='Edge Betweenness')
61+
plt.colorbar(norm1, cax=cax1, orientation="horizontal", label="Vertex Betweenness")
62+
plt.colorbar(norm2, cax=cax2, orientation="horizontal", label="Edge Betweenness")
6363

6464

6565
# %%

doc/examples_sphinx-gallery/bipartite_matching.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
This example demonstrates an efficient way to find and visualise a maximum biparite matching using :meth:`igraph.Graph.maximum_bipartite_matching`.
99
"""
10+
1011
import igraph as ig
1112
import matplotlib.pyplot as plt
1213

@@ -16,7 +17,7 @@
1617
# - nodes 5-8 to the other side
1718
g = ig.Graph.Bipartite(
1819
[0, 0, 0, 0, 0, 1, 1, 1, 1],
19-
[(0, 5), (1, 6), (1, 7), (2, 5), (2, 8), (3, 6), (4, 5), (4, 6)]
20+
[(0, 5), (1, 6), (1, 7), (2, 5), (2, 8), (3, 6), (4, 5), (4, 6)],
2021
)
2122

2223
# %%

doc/examples_sphinx-gallery/bipartite_matching_maxflow.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
1010
.. note:: :meth:`igraph.Graph.maximum_bipartite_matching` is usually a better way to find the maximum bipartite matching. For a demonstration on how to use that method instead, check out :ref:`tutorials-bipartite-matching`.
1111
"""
12+
1213
import igraph as ig
1314
import matplotlib.pyplot as plt
1415

@@ -17,7 +18,7 @@
1718
g = ig.Graph(
1819
9,
1920
[(0, 4), (0, 5), (1, 4), (1, 6), (1, 7), (2, 5), (2, 7), (2, 8), (3, 6), (3, 7)],
20-
directed=True
21+
directed=True,
2122
)
2223

2324
# %%
@@ -62,6 +63,6 @@
6263
vertex_size=30,
6364
vertex_label=range(g.vcount()),
6465
vertex_color=["lightblue" if i < 9 else "orange" for i in range(11)],
65-
edge_width=[1.0 + flow.flow[i] for i in range(g.ecount())]
66+
edge_width=[1.0 + flow.flow[i] for i in range(g.ecount())],
6667
)
6768
plt.show()

doc/examples_sphinx-gallery/bridges.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
This example shows how to compute and visualize the `bridges <https://en.wikipedia.org/wiki/Bridge_(graph_theory)>`_ in a graph using :meth:`igraph.GraphBase.bridges`. For an example on articulation points instead, see :ref:`tutorials-articulation-points`.
99
"""
10+
1011
import igraph as ig
1112
import matplotlib.pyplot as plt
1213

@@ -37,7 +38,7 @@
3738
target=ax,
3839
vertex_size=30,
3940
vertex_color="lightblue",
40-
vertex_label=range(g.vcount())
41+
vertex_label=range(g.vcount()),
4142
)
4243
plt.show()
4344

@@ -72,9 +73,9 @@
7273
vertex_size=30,
7374
vertex_color="lightblue",
7475
vertex_label=range(g.vcount()),
75-
edge_background="#FFF0", # transparent background color
76-
edge_align_label=True, # make sure labels are aligned with the edge
76+
edge_background="#FFF0", # transparent background color
77+
edge_align_label=True, # make sure labels are aligned with the edge
7778
edge_label=g.es["label"],
78-
edge_label_color="red"
79+
edge_label_color="red",
7980
)
8081
plt.show()

doc/examples_sphinx-gallery/cluster_contraction.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
This example shows how to find the communities in a graph, then contract each community into a single node using :class:`igraph.clustering.VertexClustering`. For this tutorial, we'll use the *Donald Knuth's Les Miserables Network*, which shows the coapperances of characters in the novel *Les Miserables*.
99
"""
10+
1011
import igraph as ig
1112
import matplotlib.pyplot as plt
1213

@@ -106,7 +107,10 @@
106107
# Finally, we can assign colors to the clusters and plot the cluster graph,
107108
# including a legend to make things clear:
108109
palette2 = ig.GradientPalette("gainsboro", "black")
109-
g.es["color"] = [palette2.get(int(i)) for i in ig.rescale(cluster_graph.es["size"], (0, 255), clamp=True)]
110+
g.es["color"] = [
111+
palette2.get(int(i))
112+
for i in ig.rescale(cluster_graph.es["size"], (0, 255), clamp=True)
113+
]
110114

111115
fig2, ax2 = plt.subplots()
112116
ig.plot(
@@ -123,7 +127,8 @@
123127
legend_handles = []
124128
for i in range(num_communities):
125129
handle = ax2.scatter(
126-
[], [],
130+
[],
131+
[],
127132
s=100,
128133
facecolor=palette1.get(i),
129134
edgecolor="k",
@@ -133,7 +138,7 @@
133138

134139
ax2.legend(
135140
handles=legend_handles,
136-
title='Community:',
141+
title="Community:",
137142
bbox_to_anchor=(0, 1.0),
138143
bbox_transform=ax2.transAxes,
139144
)

doc/examples_sphinx-gallery/complement.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
This example shows how to generate the `complement graph <https://en.wikipedia.org/wiki/Complement_graph>`_ of a graph (sometimes known as the anti-graph) using :meth:`igraph.GraphBase.complementer`.
99
"""
10+
1011
import igraph as ig
1112
import matplotlib.pyplot as plt
1213
import random
@@ -49,27 +50,27 @@
4950
layout="circle",
5051
vertex_color="black",
5152
)
52-
axs[0, 0].set_title('Original graph')
53+
axs[0, 0].set_title("Original graph")
5354
ig.plot(
5455
g2,
5556
target=axs[0, 1],
5657
layout="circle",
5758
vertex_color="black",
5859
)
59-
axs[0, 1].set_title('Complement graph')
60+
axs[0, 1].set_title("Complement graph")
6061

6162
ig.plot(
6263
g_full,
6364
target=axs[1, 0],
6465
layout="circle",
6566
vertex_color="black",
6667
)
67-
axs[1, 0].set_title('Union graph')
68+
axs[1, 0].set_title("Union graph")
6869
ig.plot(
6970
g_empty,
7071
target=axs[1, 1],
7172
layout="circle",
7273
vertex_color="black",
7374
)
74-
axs[1, 1].set_title('Complement of union graph')
75+
axs[1, 1].set_title("Complement of union graph")
7576
plt.show()

doc/examples_sphinx-gallery/configuration.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
This example shows how to use igraph's :class:`configuration instance <igraph.Configuration>` to set default igraph settings. This is useful for setting global settings so that they don't need to be explicitly stated at the beginning of every igraph project you work on.
99
"""
10+
1011
import igraph as ig
1112
import matplotlib.pyplot as plt
1213
import random
@@ -18,16 +19,16 @@
1819
ig.config["plotting.palette"] = "rainbow"
1920

2021
# %%
21-
# Then, we save them. By default, ``ig.config.save()`` will save files to
22-
# ``~/.igraphrc`` on Linux and Max OS X systems, or in
23-
# ``%USERPROFILE%\.igraphrc`` for Windows systems:
24-
ig.config.save()
22+
# The updated configuration affects only the current session. Optionally, it
23+
# can be saved using ``ig.config.save()``. By default, this function writes the
24+
# configuration to ``~/.igraphrc`` on Linux and Max OS X systems, and in
25+
# ``%USERPROFILE%\.igraphrc`` on Windows systems.
2526

2627
# %%
27-
# The code above only needs to be run once (to store the new config options
28-
# into the ``.igraphrc`` file). Whenever you use igraph and this file exists,
29-
# igraph will read its content and use those options as defaults. For
30-
# example, let's create and plot a new graph to demonstrate:
28+
# The configuration only needs to be saved to `.igraphrc` once, and it will
29+
# be automatically used in all future sessions. Whenever you use igraph and
30+
# this file exists, igraph will read its content and use those options as
31+
# defaults. For example, let's create and plot a new graph to demonstrate:
3132
random.seed(1)
3233
g = ig.Graph.Barabasi(n=100, m=1)
3334

0 commit comments

Comments
 (0)