A simple underected graph using Jung Java package
Source code name: "graph_jung_test1.py"
Programming language: Python
Topic: Data mining/Graphs
DMelt Version 1.5. Last modified: 06/19/1971. License: Pro
https://datamelt.org/code/cache/graph_jung_test1_2707.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 edu.uci.ics.jung.graph import UndirectedSparseGraph
from edu.uci.ics.jung.graph.util import EdgeType
graph = UndirectedSparseGraph();
graph.addEdge(1, "v1", "v2", EdgeType.UNDIRECTED)
graph.addEdge(2, "v2", "v3", EdgeType.UNDIRECTED)
graph.addEdge(3, "v3", "v1", EdgeType.UNDIRECTED)
graph.addEdge(4, "v5", "v1", EdgeType.UNDIRECTED)

from edu.uci.ics.jung.visualization import VisualizationViewer
from edu.uci.ics.jung.algorithms.layout import FRLayout
from javax.swing import JFrame

jf = JFrame()
vv = VisualizationViewer(FRLayout(graph))
jf.getContentPane().add(vv)
jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE)
jf.pack()
jf.setVisible(True)


You see the box below because you did not login.