Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use available graph python package? #6

Open
brandimarte opened this issue Jul 10, 2018 · 1 comment
Open

Use available graph python package? #6

brandimarte opened this issue Jul 10, 2018 · 1 comment
Labels
idea Unsure proposals for new features or improvments

Comments

@brandimarte
Copy link
Member

There are many python network/graph packages out there. With a quick search one can find for instance 'NetworkX' package. So the following questions arise:

  1. Could we take advantage of the already implemented algorithms in those packages?
  2. If answer of '1' is 'yes', which package would suit us better?
@brandimarte
Copy link
Member Author

brandimarte commented Jul 13, 2018

With NetworkX, the solution to the problem of finding all elementary graphs could be solved with:

import networkx as nx
import matplotlib.pyplot as plt

# Create Directed Graph
G=nx.DiGraph()

# Add a list of nodes:
G.add_nodes_from(["a","b","c","d","e"])

# Add a list of edges:
G.add_edges_from([("a","b"),("b","c"), ("c","a"), ("b","d"), ("d","e"), ("e","a")])

# Return a list of cycles described as a list o nodes
list(nx.simple_cycles(G))

It relies on directed graph though.

@brandimarte brandimarte added the idea Unsure proposals for new features or improvments label Oct 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea Unsure proposals for new features or improvments
Projects
None yet
Development

No branches or pull requests

1 participant