Package ghidra.graph

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

• Type Parameters:
`V` - the type of vertices
`E` - the type of edges
All Known Subinterfaces:
`VisualGraph<V,​E>`
All Known Implementing Classes:
`DefaultVisualGraph`, `FilteringVisualGraph`, `GroupingVisualGraph`, `JungDirectedGraph`, `JungDirectedVisualGraph`, `JungToGDirectedGraphAdapter`, `MutableGDirectedGraphWrapper`

`public interface GDirectedGraph<V,​E extends GEdge<V>>`
A directed graph Unlike `GImplicitDirectedGraph`, this graph is constructed explicitly in memory. Edges and vertices are added and removed like any other collection, and these elements represent the entirety of the graph at any given time.
• ### Method Summary

All Methods
Modifier and Type Method Description
`void` `addEdge​(E e)`
`boolean` `addVertex​(V v)`
`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

`boolean addVertex​(V v)`
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

`void addEdge​(E e)`
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
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
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

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

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.

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
{"ft_lang_label":"__label__en","ft_lang_prob":0.52559733,"math_prob":0.5816853,"size":5761,"snap":"2023-14-2023-23","text_gpt3_token_len":1409,"char_repetition_ratio":0.18047594,"word_repetition_ratio":0.409257,"special_character_ratio":0.20725569,"punctuation_ratio":0.11431412,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9960144,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-03-26T15:39:52Z\",\"WARC-Record-ID\":\"<urn:uuid:0ef25637-b9fc-4584-af18-299babca2b26>\",\"Content-Length\":\"32026\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b1655d94-518f-4d4c-bc41-af6a4e25d7be>\",\"WARC-Concurrent-To\":\"<urn:uuid:8f43e1af-b6c3-427a-8c01-fe2ac96edc30>\",\"WARC-IP-Address\":\"192.30.252.153\",\"WARC-Target-URI\":\"http://hwreblog.com/9.1/api/ghidra/graph/GDirectedGraph.html\",\"WARC-Payload-Digest\":\"sha1:YGBOP3GRTGGONARF2QZP6YRVX4N4ASBQ\",\"WARC-Block-Digest\":\"sha1:CO2TW4AMIKQT66JWCNKGOOVTL2EB6MY4\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-14/CC-MAIN-2023-14_segments_1679296945473.69_warc_CC-MAIN-20230326142035-20230326172035-00324.warc.gz\"}"}