Showing a simple graph with HGraph using strings
Source code name: "graph_simple.py"
Programming language: Python
Topic: Data mining/Graphs
DMelt Version 1.4. Last modified: 06/13/2017. License: Pro
https://datamelt.org/code/cache/graph_simple_4000.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


from jhplot  import *
import sys

g=HGraph().buildDirectedGraph()

v1,v2,v3,v4 = "v1","v2","v3","v4"

# add vertexes
g.addVertex(v1);
g.addVertex(v2);
g.addVertex(v3);
g.addVertex(v4);

g.addEdge(v1, v2);
g.addEdge(v2, v3);
g.addEdge(v3, v1);
g.addEdge(v4, v3);

HGraph().showGraph(g) # show the graph in GUI




You see the box below because you did not login.