%global _empty_manifest_terminate_build 0 Name: python-GraphRicciCurvature Version: 0.5.3.1 Release: 1 Summary: Compute discrete Ricci curvatures and Ricci flow on NetworkX graphs. License: Apache Software License URL: https://github.com/saibalmars/GraphRicciCurvature Source0: https://mirrors.aliyun.com/pypi/web/packages/70/6a/57a10107a146545c9e9cbf6dfb1f05489c9b691618001ff91159a3864a8c/GraphRicciCurvature-0.5.3.1.tar.gz BuildArch: noarch Requires: python3-cython Requires: python3-numpy Requires: python3-scipy Requires: python3-networkx Requires: python3-pot Requires: python3-packaging Requires: python3-networkit Requires: python3-louvain %description This work computes the **Ollivier-Ricci Curvature**[Ni], **Ollivier-Ricci Flow**[Ni2,Ni3], **Forman-Ricci Curvature**(or **Forman curvature**)[Sreejith, Samal], and **Ricci community**[Ni3] detected by Ollivier-Ricci flow metric.

Curvature is a geometric property to describe the local shape of an object. If we draw two parallel paths on a surface with positive curvature like a sphere, these two paths move closer to each other while for a negatively curved surface like a saddle, these two paths tend to be apart. Currently there are multiple ways to discretize curvature on graph, in this library, we include two of the most frequently used discrete Ricci curvature: **Ollivier-Ricci curvature** which is based on optimal transportation theory and **Forman-Ricci curvature** which is base on CW complexes. In [Ni], edge Ricci curvature is observed to play an important role in the graph structure. An edge with positive curvature represents an edge within a cluster, while a negatively curved edge tent to be a bridge within clusters. Also, negatively curved edges are highly related to graph connectivity, with negatively curved edges removed from a connected graph, the graph soon become disconnected. Ricci flow is a process to uniformized the edge Ricci curvature of the graph. For a given graph, the Ricci flow gives a "Ricci flow metric" on each edge as edge weights, such that under these edge weights, the Ricci curvature of the graph is mostly equal everywhere. In [Ni3], this "Ricci flow metric" is shown to be able to detect communities. Both Ricci curvature and Ricci flow metric can act as a graph fingerprint for graph classification. The different graph gives different edge Ricci curvature distributions and different Ricci flow metric. Video demonstration of Ricci flow for community detection:

## Package Requirement * [NetworkX](https://github.com/networkx/networkx) >= 2.0 (Based Graph library) * [NetworKit](https://github.com/kit-parco/networkit) >= 6.1 (Shortest path algorithm) * [NumPy](https://github.com/numpy/numpy) (POT support) * [POT](https://github.com/rflamary/POT) (For optimal transportation distance) * [python-louvain](https://github.com/taynaud/python-louvain) (For faster modularity computation) ## Installation ### Installing via pip ```bash pip3 install [--user] GraphRicciCurvature ``` - From version 0.4.0, NetworKit is required to compute shortest path for density distribution. If the installation of NetworKit failed, please refer to [NetworKit' Installation instructions](https://github.com/networkit/networkit#installation-instructions). ### Upgrading via pip To run with the latest code for the best performance, upgrade GraphRicciCurvature to the latest version with pip: ```bash pip3 install [--user] --upgrade GraphRicciCurvature ``` ## Getting Started - Check the jupyter notebook tutorial on [nbviewer](https://nbviewer.jupyter.org/github/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) or [github](notebooks/tutorial.ipynb) for a walk through for the basic usage of Ricci curvature, Ricci flow, and Ricci flow for community detection. - Or you can run it in directly on [binder](https://mybinder.org/v2/gh/saibalmars/GraphRicciCurvature/master?filepath=notebooks%2Ftutorial.ipynb) (no account required) or [Google colab](https://colab.research.google.com/github/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) (Faster but Google account required). - Check the [Documentations](https://graphriccicurvature.readthedocs.io/en/latest/). - **Try out [sample graphs](https://github.com/saibalmars/RicciFlow-SampleGraphs) with precomputed Ricci curvature/flow.** ## Simple Example ```python import networkx as nx from GraphRicciCurvature.OllivierRicci import OllivierRicci from GraphRicciCurvature.FormanRicci import FormanRicci print("\n- Import an example NetworkX karate club graph") G = nx.karate_club_graph() print("\n===== Compute the Ollivier-Ricci curvature of the given graph G =====") # compute the Ollivier-Ricci curvature of the given graph G orc = OllivierRicci(G, alpha=0.5, verbose="INFO") orc.compute_ricci_curvature() print("Karate Club Graph: The Ollivier-Ricci curvature of edge (0,1) is %f" % orc.G[0][1]["ricciCurvature"]) print("\n===== Compute the Forman-Ricci curvature of the given graph G =====") frc = FormanRicci(G) frc.compute_ricci_curvature() print("Karate Club Graph: The Forman-Ricci curvature of edge (0,1) is %f" % frc.G[0][1]["formanCurvature"]) # ----------------------------------- print("\n===== Compute Ricci flow metric - Optimal Transportation Distance =====") G = nx.karate_club_graph() orc_OTD = OllivierRicci(G, alpha=0.5, method="OTD", verbose="INFO") orc_OTD.compute_ricci_flow(iterations=10) print("\n===== Compute Ricci community - by Ricci flow =====") clustering = orc_OTD.ricci_community() ``` %package -n python3-GraphRicciCurvature Summary: Compute discrete Ricci curvatures and Ricci flow on NetworkX graphs. Provides: python-GraphRicciCurvature BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-GraphRicciCurvature This work computes the **Ollivier-Ricci Curvature**[Ni], **Ollivier-Ricci Flow**[Ni2,Ni3], **Forman-Ricci Curvature**(or **Forman curvature**)[Sreejith, Samal], and **Ricci community**[Ni3] detected by Ollivier-Ricci flow metric.

Curvature is a geometric property to describe the local shape of an object. If we draw two parallel paths on a surface with positive curvature like a sphere, these two paths move closer to each other while for a negatively curved surface like a saddle, these two paths tend to be apart. Currently there are multiple ways to discretize curvature on graph, in this library, we include two of the most frequently used discrete Ricci curvature: **Ollivier-Ricci curvature** which is based on optimal transportation theory and **Forman-Ricci curvature** which is base on CW complexes. In [Ni], edge Ricci curvature is observed to play an important role in the graph structure. An edge with positive curvature represents an edge within a cluster, while a negatively curved edge tent to be a bridge within clusters. Also, negatively curved edges are highly related to graph connectivity, with negatively curved edges removed from a connected graph, the graph soon become disconnected. Ricci flow is a process to uniformized the edge Ricci curvature of the graph. For a given graph, the Ricci flow gives a "Ricci flow metric" on each edge as edge weights, such that under these edge weights, the Ricci curvature of the graph is mostly equal everywhere. In [Ni3], this "Ricci flow metric" is shown to be able to detect communities. Both Ricci curvature and Ricci flow metric can act as a graph fingerprint for graph classification. The different graph gives different edge Ricci curvature distributions and different Ricci flow metric. Video demonstration of Ricci flow for community detection:

## Package Requirement * [NetworkX](https://github.com/networkx/networkx) >= 2.0 (Based Graph library) * [NetworKit](https://github.com/kit-parco/networkit) >= 6.1 (Shortest path algorithm) * [NumPy](https://github.com/numpy/numpy) (POT support) * [POT](https://github.com/rflamary/POT) (For optimal transportation distance) * [python-louvain](https://github.com/taynaud/python-louvain) (For faster modularity computation) ## Installation ### Installing via pip ```bash pip3 install [--user] GraphRicciCurvature ``` - From version 0.4.0, NetworKit is required to compute shortest path for density distribution. If the installation of NetworKit failed, please refer to [NetworKit' Installation instructions](https://github.com/networkit/networkit#installation-instructions). ### Upgrading via pip To run with the latest code for the best performance, upgrade GraphRicciCurvature to the latest version with pip: ```bash pip3 install [--user] --upgrade GraphRicciCurvature ``` ## Getting Started - Check the jupyter notebook tutorial on [nbviewer](https://nbviewer.jupyter.org/github/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) or [github](notebooks/tutorial.ipynb) for a walk through for the basic usage of Ricci curvature, Ricci flow, and Ricci flow for community detection. - Or you can run it in directly on [binder](https://mybinder.org/v2/gh/saibalmars/GraphRicciCurvature/master?filepath=notebooks%2Ftutorial.ipynb) (no account required) or [Google colab](https://colab.research.google.com/github/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) (Faster but Google account required). - Check the [Documentations](https://graphriccicurvature.readthedocs.io/en/latest/). - **Try out [sample graphs](https://github.com/saibalmars/RicciFlow-SampleGraphs) with precomputed Ricci curvature/flow.** ## Simple Example ```python import networkx as nx from GraphRicciCurvature.OllivierRicci import OllivierRicci from GraphRicciCurvature.FormanRicci import FormanRicci print("\n- Import an example NetworkX karate club graph") G = nx.karate_club_graph() print("\n===== Compute the Ollivier-Ricci curvature of the given graph G =====") # compute the Ollivier-Ricci curvature of the given graph G orc = OllivierRicci(G, alpha=0.5, verbose="INFO") orc.compute_ricci_curvature() print("Karate Club Graph: The Ollivier-Ricci curvature of edge (0,1) is %f" % orc.G[0][1]["ricciCurvature"]) print("\n===== Compute the Forman-Ricci curvature of the given graph G =====") frc = FormanRicci(G) frc.compute_ricci_curvature() print("Karate Club Graph: The Forman-Ricci curvature of edge (0,1) is %f" % frc.G[0][1]["formanCurvature"]) # ----------------------------------- print("\n===== Compute Ricci flow metric - Optimal Transportation Distance =====") G = nx.karate_club_graph() orc_OTD = OllivierRicci(G, alpha=0.5, method="OTD", verbose="INFO") orc_OTD.compute_ricci_flow(iterations=10) print("\n===== Compute Ricci community - by Ricci flow =====") clustering = orc_OTD.ricci_community() ``` %package help Summary: Development documents and examples for GraphRicciCurvature Provides: python3-GraphRicciCurvature-doc %description help This work computes the **Ollivier-Ricci Curvature**[Ni], **Ollivier-Ricci Flow**[Ni2,Ni3], **Forman-Ricci Curvature**(or **Forman curvature**)[Sreejith, Samal], and **Ricci community**[Ni3] detected by Ollivier-Ricci flow metric.

Curvature is a geometric property to describe the local shape of an object. If we draw two parallel paths on a surface with positive curvature like a sphere, these two paths move closer to each other while for a negatively curved surface like a saddle, these two paths tend to be apart. Currently there are multiple ways to discretize curvature on graph, in this library, we include two of the most frequently used discrete Ricci curvature: **Ollivier-Ricci curvature** which is based on optimal transportation theory and **Forman-Ricci curvature** which is base on CW complexes. In [Ni], edge Ricci curvature is observed to play an important role in the graph structure. An edge with positive curvature represents an edge within a cluster, while a negatively curved edge tent to be a bridge within clusters. Also, negatively curved edges are highly related to graph connectivity, with negatively curved edges removed from a connected graph, the graph soon become disconnected. Ricci flow is a process to uniformized the edge Ricci curvature of the graph. For a given graph, the Ricci flow gives a "Ricci flow metric" on each edge as edge weights, such that under these edge weights, the Ricci curvature of the graph is mostly equal everywhere. In [Ni3], this "Ricci flow metric" is shown to be able to detect communities. Both Ricci curvature and Ricci flow metric can act as a graph fingerprint for graph classification. The different graph gives different edge Ricci curvature distributions and different Ricci flow metric. Video demonstration of Ricci flow for community detection:

## Package Requirement * [NetworkX](https://github.com/networkx/networkx) >= 2.0 (Based Graph library) * [NetworKit](https://github.com/kit-parco/networkit) >= 6.1 (Shortest path algorithm) * [NumPy](https://github.com/numpy/numpy) (POT support) * [POT](https://github.com/rflamary/POT) (For optimal transportation distance) * [python-louvain](https://github.com/taynaud/python-louvain) (For faster modularity computation) ## Installation ### Installing via pip ```bash pip3 install [--user] GraphRicciCurvature ``` - From version 0.4.0, NetworKit is required to compute shortest path for density distribution. If the installation of NetworKit failed, please refer to [NetworKit' Installation instructions](https://github.com/networkit/networkit#installation-instructions). ### Upgrading via pip To run with the latest code for the best performance, upgrade GraphRicciCurvature to the latest version with pip: ```bash pip3 install [--user] --upgrade GraphRicciCurvature ``` ## Getting Started - Check the jupyter notebook tutorial on [nbviewer](https://nbviewer.jupyter.org/github/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) or [github](notebooks/tutorial.ipynb) for a walk through for the basic usage of Ricci curvature, Ricci flow, and Ricci flow for community detection. - Or you can run it in directly on [binder](https://mybinder.org/v2/gh/saibalmars/GraphRicciCurvature/master?filepath=notebooks%2Ftutorial.ipynb) (no account required) or [Google colab](https://colab.research.google.com/github/saibalmars/GraphRicciCurvature/blob/master/notebooks/tutorial.ipynb) (Faster but Google account required). - Check the [Documentations](https://graphriccicurvature.readthedocs.io/en/latest/). - **Try out [sample graphs](https://github.com/saibalmars/RicciFlow-SampleGraphs) with precomputed Ricci curvature/flow.** ## Simple Example ```python import networkx as nx from GraphRicciCurvature.OllivierRicci import OllivierRicci from GraphRicciCurvature.FormanRicci import FormanRicci print("\n- Import an example NetworkX karate club graph") G = nx.karate_club_graph() print("\n===== Compute the Ollivier-Ricci curvature of the given graph G =====") # compute the Ollivier-Ricci curvature of the given graph G orc = OllivierRicci(G, alpha=0.5, verbose="INFO") orc.compute_ricci_curvature() print("Karate Club Graph: The Ollivier-Ricci curvature of edge (0,1) is %f" % orc.G[0][1]["ricciCurvature"]) print("\n===== Compute the Forman-Ricci curvature of the given graph G =====") frc = FormanRicci(G) frc.compute_ricci_curvature() print("Karate Club Graph: The Forman-Ricci curvature of edge (0,1) is %f" % frc.G[0][1]["formanCurvature"]) # ----------------------------------- print("\n===== Compute Ricci flow metric - Optimal Transportation Distance =====") G = nx.karate_club_graph() orc_OTD = OllivierRicci(G, alpha=0.5, method="OTD", verbose="INFO") orc_OTD.compute_ricci_flow(iterations=10) print("\n===== Compute Ricci community - by Ricci flow =====") clustering = orc_OTD.ricci_community() ``` %prep %autosetup -n GraphRicciCurvature-0.5.3.1 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-GraphRicciCurvature -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 0.5.3.1-1 - Package Spec generated