MCPcopy Create free account

hub / github.com/dominikbraun/graph / functions

Functions245 in github.com/dominikbraun/graph

↓ 87 callersMethodAddEdge
AddEdge should add an edge between the vertices with the given source and target hashes. If either vertex doesn't exit, ErrVertexNotFound should be r
store.go:39
↓ 65 callersMethodAddVertex
AddVertex should add the given vertex with the given hash value and vertex properties to the graph. If the vertex already exists, it is up to you whet
store.go:17
↓ 52 callersFunctionNew
New creates a new graph with vertices of type T, identified by hash values of type K. These hash values will be obtained using the provided hash funct
graph.go:255
↓ 30 callersFunctionDirected
Directed creates a directed graph. This has implications on graph traversal and the order of arguments of the Edge and AddEdge functions.
traits.go:20
↓ 24 callersFunctionEdgeWeight
EdgeWeight returns a function that sets the weight of an edge to the given weight. This is a functional option for the [graph.Graph.Edge] and [graph.G
graph.go:318
↓ 24 callersFunctionnewMemoryStore
()
store.go:78
↓ 21 callersMethodAdjacencyMap
AdjacencyMap computes an adjacency map with all vertices in the graph. There is an entry for each vertex. Each of those entries is another map whose
graph.go:174
↓ 20 callersMethodTraits
Traits returns the graph's traits. Those traits must be set when creating a graph using New.
graph.go:68
↓ 20 callersMethodVertex
Vertex should return the vertex and vertex properties with the given hash value. If the vertex doesn't exist, ErrVertexNotFound should be returned.
store.go:21
↓ 18 callersFunctioncopyEdge
copyEdge returns an argument list suitable for the Graph.AddEdge method. This argument list is derived from the given edge, hence the name copyEdge.
directed.go:315
↓ 14 callersMethodEdge
Edge should return the edge joining the vertices with the given hash values. It should exclusively look for an edge between the source and the target
store.go:61
↓ 11 callersMethodLen
()
collection.go:82
↓ 11 callersFunctionedgesAreEqual
(a, b Edge[K], directed bool)
directed_test.go:1391
↓ 11 callersFunctionnewDirected
(hash Hash[K, T], traits *Traits, store Store[K, T])
directed.go:14
↓ 11 callersFunctionnewUndirected
(hash Hash[K, T], traits *Traits, store Store[K, T])
undirected.go:14
↓ 11 callersFunctiontraitsAreEqual
(a, b *Traits)
traits_test.go:139
↓ 8 callersMethodRemoveEdge
RemoveEdge should remove the edge between the vertices with the given source and target hashes. If either vertex doesn't exist, it is up to you wheth
store.go:51
↓ 8 callersFunctioncopyVertexProperties
(source VertexProperties)
sets.go:117
↓ 7 callersMethodRemoveVertex
RemoveVertex should remove the vertex with the given hash value. If the vertex doesn't exist, ErrVertexNotFound should be returned. If the vertex has
store.go:26
↓ 7 callersMethodVertexWithProperties
VertexWithProperties returns the vertex with the given hash along with its properties or ErrVertexNotFound if it doesn't exist.
graph.go:93
↓ 7 callersMethodisEmpty
()
collection.go:114
↓ 6 callersFunctionEdgeData
EdgeData returns a function that sets the data of an edge to the given value. This is a functional option for the [graph.Graph.Edge] and [graph.Graph.
graph.go:345
↓ 6 callersMethodPredecessorMap
PredecessorMap computes a predecessor map with all vertices in the graph. It has the same map layout and does the same thing as AdjacencyMap, but for
graph.go:197
↓ 6 callersMethodPush
(item interface{})
collection.go:96
↓ 6 callersFunctionVertexAttribute
VertexAttribute returns a function that adds the given key-value pair to the vertex attributes. This is a functional option for the [graph.Graph.Verte
graph.go:375
↓ 6 callersMethodtop
()
collection.go:113
↓ 5 callersMethodListEdges
ListEdges should return all edges in the graph in a slice.
store.go:64
↓ 5 callersMethodOrder
Order returns the number of vertices in the graph.
graph.go:207
↓ 5 callersMethodPop
()
collection.go:102
↓ 5 callersMethodUpdateEdge
UpdateEdge should update the edge between the given vertices with the data of the given Edge instance. If the edge doesn't exist, ErrEdgeNotFound shou
store.go:43
↓ 5 callersFunctionVertexWeight
VertexWeight returns a function that sets the weight of a vertex to the given weight. This is a functional option for the [graph.Graph.Vertex] and [gr
graph.go:366
↓ 5 callersFunctionadjacencyMapsAreEqual
(a, b map[K]map[K]Edge[K], edgesAreEqual func(a, b Edge[K]) bool)
sets_test.go:288
↓ 5 callersMethodfind
(vertex K)
sets.go:98
↓ 4 callersMethodAddEdgesFrom
AddEdgesFrom adds all edges along with their properties from the given graph to the receiving graph. All vertices that the edges are joining have to
graph.go:122
↓ 4 callersMethodAddVerticesFrom
AddVerticesFrom adds all vertices along with their properties from the given graph to the receiving graph. All vertices will be added until an error
graph.go:85
↓ 4 callersMethodClone
Clone creates a deep copy of the graph and returns that cloned graph. The cloned graph will use the default in-memory store for storing the vertices
graph.go:204
↓ 4 callersFunctionCreatesCycle
CreatesCycle determines whether adding an edge between the two given vertices would introduce a cycle in the graph. CreatesCycle will not create an ed
paths.go:16
↓ 4 callersFunctionEdgeAttribute
EdgeAttribute returns a function that adds the given key-value pair to the attributes of an edge. This is a functional option for the [graph.Graph.Edg
graph.go:327
↓ 4 callersMethodEdges
Edges returns a slice of all edges in the graph. These edges are of type Edge[K] and hence will contain the vertex hashes, not the vertex values.
graph.go:131
↓ 4 callersFunctionWeighted
Weighted creates a weighted graph. To set weights, use the Edge and AddEdge functions.
traits.go:35
↓ 4 callersMethodpop
()
collection.go:112
↓ 4 callersMethodpush
(T)
collection.go:111
↓ 3 callersFunctionAcyclic
Acyclic creates an acyclic graph. Note that creating edges that form a cycle will still be possible. To prevent this explicitly, use PreventCycles.
traits.go:28
↓ 3 callersMethodListVertices
ListVertices should return all vertices in the graph in a slice.
store.go:29
↓ 3 callersMethodaddEdge
(sourceHash, targetHash K, edge Edge[K])
directed.go:241
↓ 3 callersMethodforEach
forEach iterate the stack from bottom to top
collection.go:116
↓ 3 callersFunctionslicesAreEqual
(a, b []T)
directed_test.go:1350
↓ 2 callersMethodAdjacencyMap
()
undirected.go:256
↓ 2 callersFunctionBFS
BFS performs a breadth-first search on the graph, starting from the given vertex. The visit function will be invoked with the hash of the vertex curre
traversal.go:101
↓ 2 callersFunctionBFSWithDepth
BFSWithDepth works just as BFS and performs a breadth-first search on the graph, but its visit function is passed the current depth level as a second
traversal.go:119
↓ 2 callersFunctionDFS
DFS performs a depth-first search on the graph, starting from the given vertex. The visit function will be invoked with the hash of the vertex current
traversal.go:35
↓ 2 callersMethodEdge
(sourceHash, targetHash K)
directed.go:134
↓ 2 callersMethodEdge
(sourceHash, targetHash K)
undirected.go:138
↓ 2 callersFunctionMaximumSpanningTree
MaximumSpanningTree returns a minimum spanning tree within the given graph. The MST contains all vertices from the given graph as well as the require
trees.go:21
↓ 2 callersFunctionMinimumSpanningTree
MinimumSpanningTree returns a minimum spanning tree within the given graph. The MST contains all vertices from the given graph as well as the require
trees.go:13
↓ 2 callersFunctionNewLike
NewLike creates a graph that is "like" the given graph: It has the same type, the same hashing function, and the same traits. The new graph is indepen
graph.go:283
↓ 2 callersFunctionRooted
Rooted creates a rooted graph. This is particularly common for building tree data structures.
traits.go:42
↓ 2 callersFunctionShortestPath
ShortestPath computes the shortest path between a source and a target vertex under consideration of the edge weights. It returns a slice of hash value
paths.go:70
↓ 2 callersMethodSize
Size returns the number of edges in the graph.
graph.go:210
↓ 2 callersFunctionStronglyConnectedComponents
StronglyConnectedComponents detects all strongly connected components within the graph and returns the hashes of the vertices shaping these components
paths.go:155
↓ 2 callersFunctionTopologicalSort
TopologicalSort runs a topological sort on a given directed graph and returns the vertex hashes in topological order. The topological order is a non-u
dag.go:20
↓ 2 callersFunctionTransitiveReduction
TransitiveReduction returns a new graph with the same vertices and the same reachability as the given graph, but with as few edges as possible. The gr
dag.go:155
↓ 2 callersMethodUpdatePriority
UpdatePriority updates the priority of a given item and sets it to the given priority. If the item doesn't exist, nothing happens. This operation may
collection.go:69
↓ 2 callersMethodVertex
(k K)
store.go:120
↓ 2 callersMethodVertexCount
VertexCount should return the number of vertices in the graph. This should be equal to the length of the slice returned by ListVertices.
store.go:33
↓ 2 callersMethodadd
(vertex K)
sets.go:83
↓ 2 callersMethodedgesAreEqual
(a, b Edge[T])
directed.go:289
↓ 2 callersFunctiongenerateDOT
(g graph.Graph[K, T], options ...func(*description))
draw/draw.go:89
↓ 2 callersFunctionmapsAreEqual
(a, b map[K]K)
sets_test.go:330
↓ 2 callersFunctionmapsAreEqual
(a, b map[K]V, equals func(a, b V) bool)
draw/draw_test.go:420
↓ 2 callersFunctionnormalizeOutput
(output string)
draw/draw_test.go:438
↓ 2 callersFunctionrenderDOT
(w io.Writer, d description)
draw/draw.go:138
↓ 2 callersFunctionspanningTree
(g Graph[K, T], maximum bool)
trees.go:25
↓ 2 callersMethodunion
(vertex1, vertex2 K)
sets.go:87
↓ 2 callersFunctionvertexPropertiesAreEqual
(a, b VertexProperties)
directed_test.go:1370
↓ 1 callersMethodAddEdge
(sourceHash, targetHash K, options ...func(*EdgeProperties))
directed.go:78
↓ 1 callersMethodAddEdge
(sourceHash, targetHash K, options ...func(*EdgeProperties))
undirected.go:59
↓ 1 callersMethodAddVertex
(value T, options ...func(*VertexProperties))
directed.go:26
↓ 1 callersMethodAddVertex
(value T, options ...func(*VertexProperties))
undirected.go:26
↓ 1 callersMethodAdjacencyMap
()
directed.go:190
↓ 1 callersFunctionAllPathsBetween
AllPathsBetween computes and returns all paths between two given vertices. A path is represented as a slice of vertex hashes. The returned slice conta
paths.go:242
↓ 1 callersMethodCreatesCycle
CreatesCycle is a fastpath version of [CreatesCycle] that avoids calling [PredecessorMap], which generates large amounts of garbage to collect. Becau
store.go:239
↓ 1 callersMethodEdge
(sourceHash, targetHash K)
store.go:204
↓ 1 callersFunctionEdgeAttributes
EdgeAttributes returns a function that sets the given map as the attributes of an edge. This is a functional option for the [graph.Graph.AddEdge] and
graph.go:336
↓ 1 callersFunctionGraphAttribute
GraphAttribute is a functional option for the [DOT] method.
draw/draw.go:83
↓ 1 callersFunctionIntHash
IntHash is a hashing function that accepts an integer and uses that exact integer as a hash value. Using it as Hash will yield a Graph[int, int].
graph.go:311
↓ 1 callersFunctionNewWithStore
NewWithStore creates a new graph same as [New] but uses the provided store instead of the default memory store.
graph.go:261
↓ 1 callersFunctionPreventCycles
PreventCycles creates an acyclic graph that prevents and proactively prevents the creation of cycles. These cycle checks affect the performance and co
traits.go:58
↓ 1 callersFunctionStableTopologicalSort
StableTopologicalSort does the same as [TopologicalSort], but takes a function for comparing (and then ordering) two given vertices. This allows for a
dag.go:76
↓ 1 callersFunctionStringHash
StringHash is a hashing function that accepts a string and uses that exact string as a hash value. Using it as Hash will yield a Graph[string, string]
graph.go:305
↓ 1 callersFunctionTree
Tree is an alias for Acyclic and Rooted, since most trees in Computer Science are rooted trees.
traits.go:49
↓ 1 callersFunctionUnion
Union combines two given graphs into a new graph. The vertex hashes in both graphs are expected to be unique. The two input graphs will remain unchang
sets.go:12
↓ 1 callersFunctionVertexAttributes
VertexAttributes returns a function that sets the given map as the attributes of a vertex. This is a functional option for the [graph.Graph.AddVertex]
graph.go:383
↓ 1 callersMethodaddEdge
(sourceHash, targetHash K, edge Edge[K])
undirected.go:347
↓ 1 callersFunctionadjacencyList
(store Store[K, T], vertexHash K)
undirected_test.go:1399
↓ 1 callersMethodcreatesCycle
(source, target K)
directed.go:298
↓ 1 callersFunctionfindSCC
(vertexHash K, state *sccState[K])
paths.go:184
↓ 1 callersMethodisEmpty
()
collection.go:153
↓ 1 callersFunctionnewStack
()
collection.go:119
↓ 1 callersFunctionnewUnionFind
(vertices ...K)
sets.go:71
next →1–100 of 245, ranked by callers