Interface IGraph

  • All Known Implementing Classes:
    DirectedGraph, G, Gci, Gi, UndirectedGraph

    public interface IGraph
    Author:
    Jean-Guillaume Fages, Xavier Lorca

    Provide an interface for the graph manipulation

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean addNode​(int x)
      Adds node x to the node set of the graph
      int getNbMaxNodes()
      The maximum number of nodes in the graph Vertices of the graph belong to [0,getNbMaxNodes()-1] This quantity is fixed at the creation of the graph
      ISet getNodes()  
      ISet getPredOrNeighOf​(int x)
      Get either x's predecessors or neighbors.
      ISet getSuccOrNeighOf​(int x)
      Get either x's successors or neighbors.
      SetType getType()
      Get the type of data structures used in the graph
      default String graphVizExport()
      Export graph to graphviz format, see http://www.webgraphviz.com/
      boolean isArcOrEdge​(int x, int y)
      If this is directed returns true if and only if arc (x,y) exists Else, if this is undirected returns true if and only if edge (x,y) exists
      boolean isDirected()  
      boolean removeNode​(int x)
      Remove node x from the graph
    • Method Detail

      • getNodes

        ISet getNodes()
        Returns:
        the collection of nodes present in the graph
      • addNode

        boolean addNode​(int x)
        Adds node x to the node set of the graph
        Parameters:
        x - a node index
        Returns:
        true iff x was not already present in the graph
      • removeNode

        boolean removeNode​(int x)
        Remove node x from the graph
        Parameters:
        x - a node index
        Returns:
        true iff x was present in the graph
      • getNbMaxNodes

        int getNbMaxNodes()
        The maximum number of nodes in the graph Vertices of the graph belong to [0,getNbMaxNodes()-1] This quantity is fixed at the creation of the graph
        Returns:
        the maximum number of nodes of the graph
      • getType

        SetType getType()
        Get the type of data structures used in the graph
        Returns:
        the type of data structures used in the graph
      • getSuccOrNeighOf

        ISet getSuccOrNeighOf​(int x)
        Get either x's successors or neighbors.

        This method enables to capitalize some code but should be called with care

        Parameters:
        x - a node index
        Returns:
        x's successors if this is directed x's neighbors otherwise
      • getPredOrNeighOf

        ISet getPredOrNeighOf​(int x)
        Get either x's predecessors or neighbors.

        This method enables to capitalize some code but should be called with care

        Parameters:
        x - a node index
        Returns:
        x's predecessors if this is directed x's neighbors otherwise
      • isArcOrEdge

        boolean isArcOrEdge​(int x,
                            int y)
        If this is directed returns true if and only if arc (x,y) exists Else, if this is undirected returns true if and only if edge (x,y) exists

        This method enables to capitalize some code but should be called with care

        Parameters:
        x - a node index
        y - a node index
      • isDirected

        boolean isDirected()
        Returns:
        true if and only if this is a directed graph
      • graphVizExport

        default String graphVizExport()
        Export graph to graphviz format, see http://www.webgraphviz.com/
        Returns:
        a String encoding the graph to be displayed by graphViz