Commit 12e0b985 authored by Carlos GO's avatar Carlos GO
Browse files

alignment image

parent 7e5b71f0
......@@ -44,6 +44,18 @@ For a pair of graphs.
{('B', 8): ('A', 7), ('B', 9): ('A', 8), ('B', 59): ('A', 61), ('B', 7): ('A', 6), ('B', 10): ('A', 9), ('B', 37): ('A', 38), ('B', 60): ('A', 62), ('B', 31): ('A', 32), 'NILL': ('A', 37)}
```
We can also visualize the alignment.
networkx layout is tricky to get to look pretty but this can easily be exported to a better drawing tool.
Just pass the alignment object to the `graph_align` function.
```python
>>> graph_align(G, H, aln, show=True)
![](images/aln.png)
```
## Graph Embedding
......
......@@ -347,7 +347,7 @@ def _graph_draw(g, color='blue', save=None):
plt.savefig(save, format='pdf')
plt.show()
def graph_align(g1, g2, ops, title="", save=None, rna=False):
def graph_align(g1, g2, ops, title="", show=False, save=None, rna=False):
"""
Draw aligned graphs.
"""
......@@ -423,10 +423,10 @@ def graph_align(g1, g2, ops, title="", save=None, rna=False):
plt.title(f"GED: {cost} " + title)
if save:
plt.savefig(save, format="pdf")
plt.show()
if show:
plt.show()
pass
def simple_graph():
g1=nx.Graph()
g1.add_edge("A","B", label='X')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment