Search code examples
javagraphabstract-data-type

Different types of graph adt java


What are the different types of Graph ADT's that can you implement in java, can you provide a link or list? For example, a queue in java can be further specified into a Linked List.


Solution

  • Adjacency List Structure

    "Vertices are stored as records or objects, and every vertex stores a list of adjacent vertices. This data structure allows the storage of additional data on the vertices. Additional data can be stored if edges are also stored as objects, in which case each vertex stores its incident edges and each edge stores its incident vertices."

    Adjacency Matrix

    "A two-dimensional matrix, in which the rows represent source vertices and columns represent destination vertices. Data on edges and vertices must be stored externally. Only the cost for one edge can be stored between each pair of vertices."

    Incidence Matrix

    "A two-dimensional Boolean matrix, in which the rows represent the vertices and columns represent the edges. The entries indicate whether the vertex at a row is incident to the edge at a column."

    Source: https://en.wikipedia.org/wiki/Graph_(abstract_data_type)