Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to implement graph data structure in java? Is there any existing library available? [duplicate]

I would like to implement a graph data structure in java to maintain a graph of objects. How should I achieve this? Is there a readily available library which could help?

like image 266
Ankit Zalani Avatar asked Jun 19 '13 16:06

Ankit Zalani


People also ask

How do you implement a graph using data structure in Java?

Usually, we implement graphs in Java using HashMap collection. HashMap elements are in the form of key-value pairs. We can represent the graph adjacency list in a HashMap. A most common way to create a graph is by using one of the representations of graphs like adjacency matrix or adjacency list.

Does Java have a graph library?

JGraphT is a free Java graph library that provides mathematical graph-theory objects and algorithms. JGraphT supports various types of graphs including: * directed and undirected graphs. * graphs with weighted / unweighted / labeled or any user-defined edges.

What are the various data structures available in Java?

Types of Data Structures in JavaStack. Queue. Binary Tree. Binary Search Tree.


1 Answers

Is there a readily available library which could help?

DSL is the Data Structures Library in Java

JGraphT is a free Java graph library that provides mathematical graph-theory objects and algorithms.

JUNG is the Java Universal Network/Graph Framework

like image 76
bNd Avatar answered Sep 20 '22 21:09

bNd