Package org.neo4j.gds.api
Interface Graph
-
- All Superinterfaces:
BatchNodeIterable
,Degrees
,IdMap
,NodeIterator
,NodePropertyContainer
,PartialIdMap
,RelationshipIterator
,RelationshipPredicate
,RelationshipProperties
- All Known Subinterfaces:
CSRGraph
- All Known Implementing Classes:
CSRGraphAdapter
,GraphAdapter
,HugeGraph
,NodeFilteredGraph
,UnionGraph
public interface Graph extends IdMap, NodePropertyContainer, Degrees, RelationshipIterator, RelationshipProperties
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.neo4j.gds.api.BatchNodeIterable
BatchNodeIterable.BitSetIdIterator, BatchNodeIterable.IdIterable, BatchNodeIterable.IdIterator
-
Nested classes/interfaces inherited from interface org.neo4j.gds.api.IdMap
IdMap.NodeLabelConsumer
-
-
Field Summary
-
Fields inherited from interface org.neo4j.gds.api.IdMap
NOT_FOUND, START_NODE_ID
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description java.util.Optional<NodeFilteredGraph>
asNodeFilteredGraph()
If this graph is created using a node label filter, this will return a NodeFilteredGraph that represents the node set used in this graph.void
canRelease(boolean canRelease)
Graph
concurrentCopy()
boolean
hasRelationshipProperty()
default boolean
isEmpty()
boolean
isMultiGraph()
Whether the graph is guaranteed to have no parallel relationships.boolean
isUndirected()
default long
nthTarget(long sourceNodeId, int offset)
Get the n-th target node id for a givensourceNodeId
.static long
nthTarget(Graph graph, long sourceNodeId, int offset)
long
relationshipCount()
Graph
relationshipTypeFilteredGraph(java.util.Set<org.neo4j.gds.RelationshipType> relationshipTypes)
default void
release()
Release all resources which are not part of the result or IdMapdefault void
releaseProperties()
Release only the properties associated with that graph.default void
releaseTopology()
Release only the topological data associated with that graph.org.neo4j.gds.api.schema.GraphSchema
schema()
-
Methods inherited from interface org.neo4j.gds.api.BatchNodeIterable
batchIterables
-
Methods inherited from interface org.neo4j.gds.api.Degrees
degree, degreeWithoutParallelRelationships
-
Methods inherited from interface org.neo4j.gds.api.IdMap
availableNodeLabels, contains, forEachNodeLabel, hasLabel, highestNeoId, nodeCount, nodeLabels, rootIdMap, safeToMappedNodeId, toOriginalNodeId, toRootNodeId, withFilteredLabels
-
Methods inherited from interface org.neo4j.gds.api.NodeIterator
forEachNode, nodeIterator, nodeIterator
-
Methods inherited from interface org.neo4j.gds.api.properties.nodes.NodePropertyContainer
availableNodeProperties, nodeProperties
-
Methods inherited from interface org.neo4j.gds.api.PartialIdMap
rootNodeCount, toMappedNodeId
-
Methods inherited from interface org.neo4j.gds.api.RelationshipIterator
forEachRelationship, forEachRelationship, streamRelationships
-
Methods inherited from interface org.neo4j.gds.api.RelationshipPredicate
exists
-
Methods inherited from interface org.neo4j.gds.api.RelationshipProperties
relationshipProperty, relationshipProperty
-
-
-
-
Method Detail
-
schema
org.neo4j.gds.api.schema.GraphSchema schema()
-
isEmpty
default boolean isEmpty()
-
relationshipCount
long relationshipCount()
- Returns:
- returns the total number of relationships in the graph.
-
release
default void release()
Release all resources which are not part of the result or IdMap
-
releaseTopology
default void releaseTopology()
Release only the topological data associated with that graph.
-
releaseProperties
default void releaseProperties()
Release only the properties associated with that graph.
-
isUndirected
boolean isUndirected()
-
isMultiGraph
boolean isMultiGraph()
Whether the graph is guaranteed to have no parallel relationships. If this returnsfalse
it still may be parallel-free, but we do not know.- Returns:
true
iff the graph has maximum one relationship between each pair of nodes.
-
relationshipTypeFilteredGraph
Graph relationshipTypeFilteredGraph(java.util.Set<org.neo4j.gds.RelationshipType> relationshipTypes)
-
hasRelationshipProperty
boolean hasRelationshipProperty()
-
canRelease
void canRelease(boolean canRelease)
-
concurrentCopy
Graph concurrentCopy()
- Specified by:
concurrentCopy
in interfaceRelationshipIterator
- Returns:
- a copy of this iterator that reuses new cursors internally, so that iterations happen independent from other iterations.
-
asNodeFilteredGraph
java.util.Optional<NodeFilteredGraph> asNodeFilteredGraph()
If this graph is created using a node label filter, this will return a NodeFilteredGraph that represents the node set used in this graph. Be aware that it is not guaranteed to contain all relationships of the graph. Otherwise, it will return an empty Optional.
-
nthTarget
default long nthTarget(long sourceNodeId, int offset)
Get the n-th target node id for a givensourceNodeId
. The order of the targets is not defined and depends on the implementation of the graph, but it is consistent across separate calls to this method on the same graph. ThesourceNodeId
must be a node id existing in the graph. Theoffset
parameter is 0-indexed and must be positive. Ifoffset
is greater than the number of targets forsourceNodeId
,-1
is returned. It is undefined behavior if thesourceNodeId
does not exist in the graph or theoffset
is negative.- Parameters:
offset
- then
-th target to return. Must be positive.- Returns:
- the target at the
offset
or-1
if there is no such target.
-
nthTarget
static long nthTarget(Graph graph, long sourceNodeId, int offset)
-
-