 |
A simple graph with a few objects and visualization
Source code name: "grapha_with_url.py"
Programming language: Python
Topic: Data mining/Graphs
DMelt Version 1.4. Last modified: 06/11/2017. License: Pro
https://datamelt.org/code/cache/grapha_with_url_3914.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 *
from java.net import *
import sys
g=HGraph().buildDirectedGraph()
amazon =URL("http://www.amazon")
yahoo = URL("http://www.yahoo")
ebay = URL("http://www.ebay")
# add the vertices
g.addVertex(amazon)
g.addVertex(yahoo)
g.addVertex(ebay)
# add edges to create linking structure
g.addEdge(yahoo, amazon)
g.addEdge(yahoo, ebay)
# pring graph
print g
HGraph().showGraph(g) # visualize graph
# sys.exit()
You see the box below because you did not login.