Package ghidra.graph

Interface GDirectedGraph<V,​E extends GEdge<V>>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void addEdge​(E e)
      Add an edge
      boolean addVertex​(V v)
      Add a vertex
      boolean containsEdge​(E e)
      Test if the graph contains a given edge
      boolean containsEdge​(V from, V to)
      Test if the graph contains an edge from one given vertex to another
      boolean containsVertex​(V v)
      Test if the graph contains a given vertex
      GDirectedGraph<V,​E> copy()
      Copy this graph.
      GDirectedGraph<V,​E> emptyCopy()
      Creates a new instance of this graph with no vertices or edges.
      E findEdge​(V start, V end)
      Locates the edge object for the two vertices
      int getEdgeCount()
      Count the number of edges in the graph
      java.util.Collection<E> getEdges()
      Retrieve all the edges
      default java.util.Collection<E> getIncidentEdges​(V v)
      Returns all edges connected to the given vertex
      java.util.Collection<E> getInEdges​(V v)
      Compute the incident edges that end at the given vertex
      java.util.Collection<E> getOutEdges​(V v)
      Compute the incident edges that start at the given vertex
      default java.util.Collection<V> getPredecessors​(V v)
      Compute a vertex's predecessors
      default java.util.Collection<V> getSuccessors​(V v)
      Compute a vertex's successors
      int getVertexCount()
      Count the number of vertices in the graph
      java.util.Collection<V> getVertices()
      Retrieve all the vertices
      boolean isEmpty()
      Test if the graph is empty, i.e., contains no vertices or edges
      boolean removeEdge​(E e)
      Removes an edge
      void removeEdges​(java.lang.Iterable<E> edges)
      Removes the given edges from the graph
      boolean removeVertex​(V v)
      Remove a vertex
      void removeVertices​(java.lang.Iterable<V> vertices)
      Removes the given vertices from the graph
    • Method Detail

      • addVertex

        boolean addVertex​(V v)
        Add a vertex
        Parameters:
        v - the vertex
        Returns:
        true if the add was successful, false otherwise
      • removeVertex

        boolean removeVertex​(V v)
        Remove a vertex
        Parameters:
        v - the vertex
        Returns:
        true
      • removeVertices

        void removeVertices​(java.lang.Iterable<V> vertices)
        Removes the given vertices from the graph
        Parameters:
        vertices - the vertices to remove
      • addEdge

        void addEdge​(E e)
        Add an edge
        Parameters:
        e - the edge
      • removeEdge

        boolean removeEdge​(E e)
        Removes an edge
        Parameters:
        e - the edge
        Returns:
        true if the graph contained the given edge
      • removeEdges

        void removeEdges​(java.lang.Iterable<E> edges)
        Removes the given edges from the graph
        Parameters:
        edges - the edges to remove
      • findEdge

        E findEdge​(V start,
                   V end)
        Locates the edge object for the two vertices
        Parameters:
        start - the start vertex
        end - the end vertex
        Returns:
        the edge
      • getVertices

        java.util.Collection<V> getVertices()
        Retrieve all the vertices
        Returns:
        the vertices
      • getEdges

        java.util.Collection<E> getEdges()
        Retrieve all the edges
        Returns:
        the edges
      • containsVertex

        boolean containsVertex​(V v)
        Test if the graph contains a given vertex
        Parameters:
        v - the vertex
        Returns:
        true if the vertex is in the graph, or false
      • containsEdge

        boolean containsEdge​(E e)
        Test if the graph contains a given edge
        Parameters:
        e - the ege
        Returns:
        true if the edge is in the graph, or false
      • containsEdge

        boolean containsEdge​(V from,
                             V to)
        Test if the graph contains an edge from one given vertex to another
        Parameters:
        from - the source vertex
        to - the destination vertex
        Returns:
        true if such an edge exists, or false
      • isEmpty

        boolean isEmpty()
        Test if the graph is empty, i.e., contains no vertices or edges
        Returns:
        true if the graph is empty, or false
      • getVertexCount

        int getVertexCount()
        Count the number of vertices in the graph
        Returns:
        the count
      • getEdgeCount

        int getEdgeCount()
        Count the number of edges in the graph
        Returns:
        the count
      • getInEdges

        java.util.Collection<E> getInEdges​(V v)
        Compute the incident edges that end at the given vertex
        Specified by:
        getInEdges in interface GImplicitDirectedGraph<V,​E extends GEdge<V>>
        Parameters:
        v - the destination vertex
        Returns:
        the in-edges to the given vertex
      • getOutEdges

        java.util.Collection<E> getOutEdges​(V v)
        Compute the incident edges that start at the given vertex
        Specified by:
        getOutEdges in interface GImplicitDirectedGraph<V,​E extends GEdge<V>>
        Parameters:
        v - the source vertex
        Returns:
        the out-edges from the given vertex
      • getIncidentEdges

        default java.util.Collection<E> getIncidentEdges​(V v)
        Returns all edges connected to the given vertex
        Parameters:
        v - the vertex
        Returns:
        the edges
      • getPredecessors

        default java.util.Collection<V> getPredecessors​(V v)
        Compute a vertex's predecessors

        The default implementation computes this from the in-edges

        Specified by:
        getPredecessors in interface GImplicitDirectedGraph<V,​E extends GEdge<V>>
        Parameters:
        v - the destination vertex
        Returns:
        the predecessors
      • getSuccessors

        default java.util.Collection<V> getSuccessors​(V v)
        Compute a vertex's successors

        The default implementation compute this from the out-edges

        Specified by:
        getSuccessors in interface GImplicitDirectedGraph<V,​E extends GEdge<V>>
        Parameters:
        v - the source vertex
        Returns:
        the successors
      • copy

        GDirectedGraph<V,​E> copy()
        Copy this graph.

        Note: the vertices and edges in the copy may be the same instances in the new graph and not themselves copies.

        Specified by:
        copy in interface GImplicitDirectedGraph<V,​E extends GEdge<V>>
        Returns:
        the new copy
      • emptyCopy

        GDirectedGraph<V,​E> emptyCopy()
        Creates a new instance of this graph with no vertices or edges. This is useful when you wish to build a new graph using the same type as this graph.
        Returns:
        the new copy