nifty.graph¶
Functions¶
-
nifty.graph.
components
()¶
-
nifty.graph.
connectedComponentsFromNodeLabels
()¶ compute connected component labels of a node labeling
All nodes which have zero as nodeLabel will keep a zeroArguments:
- graph : the input graph
nodeLabels (numpy.ndarray): node labeling dense (bool): should the returned labeling be dense (default {True})
ignoreBackground (bool): if true, all input zeros are mapped to zeros (default {False})
Returns: connected components labels Return type: numpy.ndarray compute connected component labels of a node labeling
All nodes which have zero as nodeLabel will keep a zeroArguments:
- graph : the input graph
nodeLabels (numpy.ndarray): node labeling dense (bool): should the returned labeling be dense (default {True})
ignoreBackground (bool): if true, all input zeros are mapped to zeros (default {False})
Returns: connected components labels Return type: numpy.ndarray compute connected component labels of a node labeling
All nodes which have zero as nodeLabel will keep a zeroArguments:
- graph : the input graph
nodeLabels (numpy.ndarray): node labeling dense (bool): should the returned labeling be dense (default {True})
ignoreBackground (bool): if true, all input zeros are mapped to zeros (default {False})
Returns: connected components labels Return type: numpy.ndarray
-
nifty.graph.
drawGraph
(graph, method='spring')¶
-
nifty.graph.
edgeContractionGraph
(g, callback)¶
-
nifty.graph.
edgeWeightedWatershedsSegmentation
()¶ Edge weighted watershed on a graph
Parameters: graph – the input graph seeds (numpy.ndarray): the seeds edgeWeights (numpy.ndarray): the edge weights Returns: the segmentation Return type: numpy.ndarray Edge weighted watershed on a graph
Parameters: graph – the input graph seeds (numpy.ndarray): the seeds edgeWeights (numpy.ndarray): the edge weights Returns: the segmentation Return type: numpy.ndarray Edge weighted watershed on a graph
Parameters: graph – the input graph seeds (numpy.ndarray): the seeds edgeWeights (numpy.ndarray): the edge weights Returns: the segmentation Return type: numpy.ndarray
-
nifty.graph.
gridGraph
(shape, simpleNh=True)¶
-
nifty.graph.
longRangeGridGraph
(shape, offsets)¶
-
nifty.graph.
longRangeGridGraph3D
()¶
-
nifty.graph.
nodeWeightedWatershedsSegmentation
()¶ Node weighted watershed on a graph
Parameters: graph – the input graph seeds (numpy.ndarray): the seeds nodeWeights (numpy.ndarray): the node weights Returns: the segmentation Return type: numpy.ndarray Node weighted watershed on a graph
Parameters: graph – the input graph seeds (numpy.ndarray): the seeds nodeWeights (numpy.ndarray): the node weights Returns: the segmentation Return type: numpy.ndarray Node weighted watershed on a graph
Parameters: graph – the input graph seeds (numpy.ndarray): the seeds nodeWeights (numpy.ndarray): the node weights Returns: the segmentation Return type: numpy.ndarray
-
nifty.graph.
randomGraph
(numberOfNodes, numberOfEdges)¶
-
nifty.graph.
shortestPathMultiTargetParallel
()¶
-
nifty.graph.
shortestPathSingleTargetParallel
()¶
-
nifty.graph.
undirectedGraph
(numberOfNodes)¶
-
nifty.graph.
undirectedGridGraph
(shape, simpleNh=True)¶
-
nifty.graph.
undirectedLongRangeGridGraph
(shape, offsets)¶
Classes¶
-
class
nifty.graph.
ComponentsUndirectedGraph
¶ -
build
()¶
-
buildFromEdgeLabels
()¶
-
buildFromNodeLabels
()¶
-
componentLabels
()¶
-
-
class
nifty.graph.
ComponentsUndirectedGridGraph2DSimpleNh
¶ -
build
()¶
-
buildFromEdgeLabels
()¶
-
buildFromNodeLabels
()¶
-
componentLabels
()¶
-
-
class
nifty.graph.
ComponentsUndirectedGridGraph3DSimpleNh
¶ -
build
()¶
-
buildFromEdgeLabels
()¶
-
buildFromNodeLabels
()¶
-
componentLabels
()¶
-
-
class
nifty.graph.
EdgeContractionGraphCallback
¶
-
class
nifty.graph.
EdgeContractionGraphCallbackImpl
¶ -
contractEdgeCallback
¶
-
contractEdgeDoneCallback
¶
-
mergeEdgesCallback
¶
-
mergeNodesCallback
¶
-
-
class
nifty.graph.
EdgeContractionGraphUndirectedGraph
¶ -
MincutObjective
¶ alias of
MincutObjectiveEdgeContractionGraphUndirectedGraph
-
MulticutObjective
¶ alias of
MulticutObjectiveEdgeContractionGraphUndirectedGraph
-
baseGraph
¶
-
bfsEdges
()¶
-
contractEdge
()¶
-
edgeIdUpperBound
¶
-
edges
()¶ Get an edge iterator
Get an edge iterator to iterate over all edges
Returns: edge iterator
-
findEdge
()¶ Find an edge in the graph
Parameters: uv (tuple) – a pair of nodes Returns: edge index if edge is in graph, -1 otherwise. Return type: int Find an edge in the graph
Parameters: - u (int) – first node
- v (int) – second node
Returns: edge index if edge is in graph, -1 otherwise.
Return type: int
-
findEdges
()¶ Find multiple edges in the graph simultaneous
Parameters: uv (numpy.ndarray) – array with pairs of nodes (Ex2) Returns: array filed with edge indexes for all pairs of nodes which are in the graph and -1 otherwise. Return type: numpy.ndarray
-
findRepresentativeEdge
()¶
-
findRepresentativeNode
()¶
-
nodeAdjacency
()¶
-
nodeIdUpperBound
¶
-
nodeOfDeadEdge
()¶
-
nodeUfd
¶
-
nodes
()¶ Get an node iterator
Get an node iterator to iterate over all nodes
Returns: node iterator
-
numberOfEdges
¶
-
numberOfNodes
¶
-
reset
()¶
-
u
()¶ Get first endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the first endpoint of the edge. Return type: int
-
uv
()¶ Get both endpoints of an edge
Parameters: edge (int) – edge index Returns: pair of node indexes / enpoints of the edge. Return type: tuple
-
uvIds
()¶ Get the two endpoints of all edges simultaneous.
Returns: uv-ids as array with shape [numberOfEdges,2] Return type: numpy.ndarray
-
v
()¶ Get second endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the second endpoint of the edge. Return type: int
-
-
class
nifty.graph.
EdgeContractionGraphUndirectedGraphAdjacencyIter
¶
-
class
nifty.graph.
EdgeContractionGraphUndirectedGraphEdgeIter
¶
-
class
nifty.graph.
EdgeContractionGraphUndirectedGraphEdgeMapFloat64
¶
-
class
nifty.graph.
EdgeContractionGraphUndirectedGraphNodeIter
¶
-
class
nifty.graph.
EdgeContractionGraphUndirectedGraphNodeMapFloat64
¶
-
class
nifty.graph.
ShortestPathDijkstra
¶ -
runSingleSourceMultiTarget
()¶
-
runSingleSourceSingleTarget
()¶
-
-
class
nifty.graph.
UndirectedGraph
¶ -
EdgeContractionGraph
¶ alias of
EdgeContractionGraphUndirectedGraph
-
LiftedMulticutObjective
¶ alias of
LiftedMulticutObjectiveUndirectedGraph
-
MincutObjective
¶ alias of
MincutObjectiveUndirectedGraph
-
MulticutObjective
¶ alias of
MulticutObjectiveUndirectedGraph
-
bfsEdges
()¶
-
deserialize
()¶
-
edgeIdUpperBound
¶
-
edges
()¶ Get an edge iterator
Get an edge iterator to iterate over all edges
Returns: edge iterator
-
extractSubgraphFromNodes
()¶
-
findEdge
()¶ Find an edge in the graph
Parameters: uv (tuple) – a pair of nodes Returns: edge index if edge is in graph, -1 otherwise. Return type: int Find an edge in the graph
Parameters: - u (int) – first node
- v (int) – second node
Returns: edge index if edge is in graph, -1 otherwise.
Return type: int
-
findEdges
()¶ Find multiple edges in the graph simultaneous
Parameters: uv (numpy.ndarray) – array with pairs of nodes (Ex2) Returns: array filed with edge indexes for all pairs of nodes which are in the graph and -1 otherwise. Return type: numpy.ndarray
-
insertEdge
()¶
-
insertEdges
()¶
-
nodeAdjacency
()¶
-
nodeIdUpperBound
¶
-
nodes
()¶ Get an node iterator
Get an node iterator to iterate over all nodes
Returns: node iterator
-
numberOfEdges
¶
-
numberOfNodes
¶
-
serialize
()¶
-
shrinkToFit
()¶
-
u
()¶ Get first endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the first endpoint of the edge. Return type: int
-
uv
()¶ Get both endpoints of an edge
Parameters: edge (int) – edge index Returns: pair of node indexes / enpoints of the edge. Return type: tuple
-
uvIds
()¶ Get the two endpoints of all edges simultaneous.
Returns: uv-ids as array with shape [numberOfEdges,2] Return type: numpy.ndarray
-
v
()¶ Get second endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the second endpoint of the edge. Return type: int
-
-
class
nifty.graph.
UndirectedGraphAdjacencyIter
¶
-
class
nifty.graph.
UndirectedGraphEdgeIter
¶
-
class
nifty.graph.
UndirectedGraphEdgeMapFloat64
¶
-
class
nifty.graph.
UndirectedGraphNodeIter
¶
-
class
nifty.graph.
UndirectedGraphNodeMapFloat64
¶
-
class
nifty.graph.
UndirectedGridGraph2DSimpleNh
¶ 2Dimensional Grid Graph
-
bfsEdges
()¶
-
coordianteToNode
()¶
-
edgeIdUpperBound
¶
-
edges
()¶ Get an edge iterator
Get an edge iterator to iterate over all edges
Returns: edge iterator
-
findEdge
()¶ Find an edge in the graph
Parameters: uv (tuple) – a pair of nodes Returns: edge index if edge is in graph, -1 otherwise. Return type: int Find an edge in the graph
Parameters: - u (int) – first node
- v (int) – second node
Returns: edge index if edge is in graph, -1 otherwise.
Return type: int
-
findEdges
()¶ Find multiple edges in the graph simultaneous
Parameters: uv (numpy.ndarray) – array with pairs of nodes (Ex2) Returns: array filed with edge indexes for all pairs of nodes which are in the graph and -1 otherwise. Return type: numpy.ndarray
-
imageToEdgeMap
()¶ convert an image to an edge map
Parameters: image (numpy.ndarray) – the image mode str: mode can be:
- ’min’: Minimum of the two image values at edges endpoints of coordinates.
- ’max’: Maximum of the two image values at edges endpoints of coordinates.
- ’sum’: Sum of the two image values at edges endpoints of coordinates.
- ’prod’: Product of the two image values at edges endpoints of coordinates.
-
nodeAdjacency
()¶
-
nodeIdUpperBound
¶
-
nodeToCoordinate
()¶
-
nodes
()¶ Get an node iterator
Get an node iterator to iterate over all nodes
Returns: node iterator
-
numberOfEdges
¶
-
numberOfNodes
¶
-
u
()¶ Get first endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the first endpoint of the edge. Return type: int
-
uv
()¶ Get both endpoints of an edge
Parameters: edge (int) – edge index Returns: pair of node indexes / enpoints of the edge. Return type: tuple
-
uvIds
()¶ Get the two endpoints of all edges simultaneous.
Returns: uv-ids as array with shape [numberOfEdges,2] Return type: numpy.ndarray
-
v
()¶ Get second endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the second endpoint of the edge. Return type: int
-
-
class
nifty.graph.
UndirectedGridGraph2DSimpleNhAdjacencyIter
¶
-
class
nifty.graph.
UndirectedGridGraph2DSimpleNhEdgeIter
¶
-
class
nifty.graph.
UndirectedGridGraph2DSimpleNhEdgeMapFloat64
¶
-
class
nifty.graph.
UndirectedGridGraph2DSimpleNhNodeIter
¶
-
class
nifty.graph.
UndirectedGridGraph2DSimpleNhNodeMapFloat64
¶
-
class
nifty.graph.
UndirectedGridGraph3DSimpleNh
¶ 3Dimensional Grid Graph
-
bfsEdges
()¶
-
coordianteToNode
()¶
-
edgeIdUpperBound
¶
-
edges
()¶ Get an edge iterator
Get an edge iterator to iterate over all edges
Returns: edge iterator
-
findEdge
()¶ Find an edge in the graph
Parameters: uv (tuple) – a pair of nodes Returns: edge index if edge is in graph, -1 otherwise. Return type: int Find an edge in the graph
Parameters: - u (int) – first node
- v (int) – second node
Returns: edge index if edge is in graph, -1 otherwise.
Return type: int
-
findEdges
()¶ Find multiple edges in the graph simultaneous
Parameters: uv (numpy.ndarray) – array with pairs of nodes (Ex2) Returns: array filed with edge indexes for all pairs of nodes which are in the graph and -1 otherwise. Return type: numpy.ndarray
-
imageToEdgeMap
()¶ convert an image to an edge map
Parameters: image (numpy.ndarray) – the image mode str: mode can be:
- ’min’: Minimum of the two image values at edges endpoints of coordinates.
- ’max’: Maximum of the two image values at edges endpoints of coordinates.
- ’sum’: Sum of the two image values at edges endpoints of coordinates.
- ’prod’: Product of the two image values at edges endpoints of coordinates.
-
nodeAdjacency
()¶
-
nodeIdUpperBound
¶
-
nodeToCoordinate
()¶
-
nodes
()¶ Get an node iterator
Get an node iterator to iterate over all nodes
Returns: node iterator
-
numberOfEdges
¶
-
numberOfNodes
¶
-
u
()¶ Get first endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the first endpoint of the edge. Return type: int
-
uv
()¶ Get both endpoints of an edge
Parameters: edge (int) – edge index Returns: pair of node indexes / enpoints of the edge. Return type: tuple
-
uvIds
()¶ Get the two endpoints of all edges simultaneous.
Returns: uv-ids as array with shape [numberOfEdges,2] Return type: numpy.ndarray
-
v
()¶ Get second endpoint of an edge
Parameters: edge (int) – edge index Returns: node index of the second endpoint of the edge. Return type: int
-
-
class
nifty.graph.
UndirectedGridGraph3DSimpleNhAdjacencyIter
¶
-
class
nifty.graph.
UndirectedGridGraph3DSimpleNhEdgeIter
¶
-
class
nifty.graph.
UndirectedGridGraph3DSimpleNhEdgeMapFloat64
¶
-
class
nifty.graph.
UndirectedGridGraph3DSimpleNhNodeIter
¶
-
class
nifty.graph.
UndirectedGridGraph3DSimpleNhNodeMapFloat64
¶