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

line graph #50

Merged
merged 2 commits into from Jul 26, 2019
Merged

line graph #50

merged 2 commits into from Jul 26, 2019

Conversation

mdeff
Copy link
Collaborator

@mdeff mdeff commented May 9, 2019

graph = pg.graphs.Sensor(5, k=2, seed=10)
line_graph = pg.graphs.LineGraph(graph)
fig, ax = plt.subplots()
graph.plot(vertex_color='blue', edge_color='blue', indices=True, ax=ax)
line_graph.plot(vertex_color='red', edge_color='red', indices=True, ax=ax)
ax.set_title('graph and its line graph')

line_graph

Todo:

  • Check for directed graphs.
  • Any way to set the edge weight?

Should be consistent with NetworkX's line_graph.

@mdeff mdeff requested a review from nperraud May 9, 2019 13:23
@coveralls
Copy link

coveralls commented May 9, 2019

Coverage Status

Coverage increased (+0.07%) to 88.13% when pulling cf8f988 on line-graph into 8ce5bde on master.

@nperraud
Copy link
Collaborator

For the edge weight, I think we should think about the properties we want the graph to have. So let us do some math. For now we could raise a warning if the original graph is weighted.

@mdeff
Copy link
Collaborator Author

mdeff commented May 10, 2019

Agreed. Warning added. For now, it creates a binary line graph in all cases (as if the original graph was unweighted).

@nperraud
Copy link
Collaborator

This looks fine for me...

@nperraud nperraud merged commit bf4e437 into master Jul 26, 2019
@mdeff mdeff deleted the line-graph branch November 8, 2019 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants