PAMI.subgraphMining.basic package

Submodules

PAMI.subgraphMining.basic.abstract module

PAMI.subgraphMining.basic.dfsCode module

class PAMI.subgraphMining.basic.dfsCode.DFSCode[source]

Bases: object

add(ee)[source]

The add function in adds elements to the EE list while updating the rightmost element and path based on certain conditions.

containEdge(v1, v2)[source]
copy()[source]
getAllVLabels()[source]

This function retrieves all vertex labels from the extended edge list and returns them in a list.

getAt(index)[source]
getEeList()[source]
getRightMost()[source]
getRightMostPath()[source]
isEmpty()[source]
notPreOfRm(v)[source]

This function checks if a given value is not the second-to-last element on the rightMostPath given a vertex.

onRightMostPath(v)[source]

PAMI.subgraphMining.basic.edge module

class PAMI.subgraphMining.basic.edge.Edge(v1, v2, edgeLabel)[source]

Bases: object

another(v)[source]
getEdgeLabel()[source]

PAMI.subgraphMining.basic.extendedEdge module

class PAMI.subgraphMining.basic.extendedEdge.ExtendedEdge(v1, v2, vLabel1, vLabel2, edgeLabel)[source]

Bases: object

getEdgeLabel()[source]
getV1()[source]
getV2()[source]
getVLabel1()[source]
getVLabel2()[source]
pairSmallerThan(x1, x2, y1, y2)[source]
smallerThan(that)[source]
smallerThanOriginal(that)[source]

PAMI.subgraphMining.basic.frequentSubgraph module

class PAMI.subgraphMining.basic.frequentSubgraph.FrequentSubgraph(dfsCode, setOfGraphsIds, support)[source]

Bases: object

PAMI.subgraphMining.basic.graph module

class PAMI.subgraphMining.basic.graph.Graph(id, vMap=None, dfsCode=None)[source]

Bases: object

emptyIntegerArray = []
emptyVertexList = []
findAllWithLabel(targetLabel)[source]
getAllNeighbors(v)[source]
getAllVertices()[source]
getEdge(v1, v2)[source]
getEdgeCount()[source]
getEdgeLabel(v1, v2)[source]
getId()[source]
getNonPrecalculatedAllVertices()[source]
getVLabel(v)[source]
isNeighboring(v1, v2)[source]
precalculateLabelsToVertices()[source]

This function precalculates and stores mappings of vertex labels to their corresponding vertex IDs.

precalculateVertexList()[source]

The function precalculateVertexList creates a list of vertices by iterating through a dictionary of vertices.

precalculateVertexNeighbors()[source]

The function precalculates the neighbors of each vertex in a graph and stores them in a cache.

removeInfrequentLabel(label)[source]

The function removes vertices with a specific label from the graph and updates the edges accordingly.

PAMI.subgraphMining.basic.gspan module

class PAMI.subgraphMining.basic.gspan.GSpan(iFile, minSupport, outputSingleVertices=True, maxNumberOfEdges=inf, outputGraphIds=False)[source]

Bases: _gSpan

class Pair(x, y)[source]

Bases: object

edge_count_pruning = True
eliminate_infrequent_edge_labels = True
eliminate_infrequent_vertex_pairs = True
eliminate_infrequent_vertices = True
findAllOnlyOneVertex(graphDb, outputFrequentVertices)[source]

The function findAllOnlyOneVertex iterates through a graph database to find frequent vertices based on a minimum support threshold, storing the results and optionally removing infrequent vertices.

Parameters:

graphDb – The graphDb parameter refers to a graph database that the algorithm is

operating on. :param outputFrequentVertices: The outputFrequentVertices parameter is a boolean flag that determines whether the frequent vertices should be included in the output or not.

gSpan(graphDb, outputFrequentVertices)[source]

The gSpan function in Python processes a graph database by precalculating vertex lists, removing infrequent vertex pairs, and performing a depth-first search algorithm.

Parameters:

graphDb – The graphDb parameter refers to a graph database that the algorithm is

operating on. :param outputFrequentVertices: The outputFrequentVertices parameter is a boolean flag that determines whether the frequent vertices should be output or not.

getFrequentSubgraphs()[source]
getMemoryRSS()[source]
getMemoryUSS()[source]
getRuntime()[source]
gspanDFS(c: DFSCode, graphDb, subgraphId)[source]

The gspanDFS function recursively explores graph patterns using the gSpan algorithm to find frequent subgraphs in a graph database.

Parameters:

c – In the provided code snippet, the parameter c is an instance of the _ab.DFSCode class.

It is used as an input to the gspanDFS method for performing Depth-First Search (DFS) traversal in a graph mining algorithm. The c parameter represents :type c: _ab.DFSCode :param graphDb: The graphDb parameter refers to a graph database that the algorithm is operating on. :param subgraphId: The subgraphId parameter in the gspanDFS method refers to an ID represents a specific subgraph within the graph database graphDb. :return: The gspanDFS method is a recursive function that is called within itself to explore the graph structure and find frequent subgraphs. The function does not have a return value, but it modifies the self.frequentSubgraphs list by appending new frequent subgraphs found during the DFS traversal.

isCanonical(c: DFSCode)[source]

The function isCanonical checks if a given DFS code is canonical by comparing it with its rightmost path extensions.

Parameters:

c (_ab.DFSCode) – The parameter c is an instance of the _ab.DFSCode class

Returns:

a boolean value. It returns True if the input DFSCode c is canonical, and False if it is

not canonical.

readGraphs(path)[source]

The readGraphs function reads graph data from a file and constructs a list of graphs with vertices and edges.

Parameters:

path – The path parameter in the readGraphs method is the file path to the text file

containing the graph data that needs to be read and processed. This method reads the graph data from the specified file and constructs a list of graphs represented by vertices and edges based on the information in the :return: The readGraphs method reads graph data from a file specified by the path parameter. It parses the data to create a list of graph objects and returns this list. Each graph object contains information about vertices and edges within the graph.

removeInfrequentVertexPairs(graphDb)[source]

The function removeInfrequentVertexPairs processes a graph database by removing infrequent vertex pairs and edge labels based on specified support thresholds.

Parameters:

graphDb – The graphDb parameter refers to a graph database that the algorithm is

operating on.

rightMostPathExtensions(c: DFSCode, graphDb, graphIds)[source]

The function rightMostPathExtensions generates extensions for a given DFS code by considering rightmost paths in a graph database.

Parameters:

c – The parameter c in the rightMostPathExtensions method is of type _ab.DFSCode. It

seems to represent a Depth-First Search code used in graph algorithms. The method is responsible for generating extensions based on the rightmost path in a graph :param graphDb: The graphDb parameter in the rightMostPathExtensions method is a database that stores graph data. It is used to retrieve graph objects based on their IDs, which are provided in the graphIds parameter. The method then performs operations on these graph objects to generate :param graphIds: The graphIds parameter in the rightMostPathExtensions function represents a list of graph identifiers. These identifiers are used to retrieve specific graphs from the graphDb database in order to perform operations on them within the function. Each ID in the graphIds list corresponds to an identifier. :return: The function rightMostPathExtensions returns a dictionary extensions containing extended edges as keys and sets of graph IDs as values.

rightMostPathExtensionsFromSingle(c: DFSCode, g: Graph)[source]

The function rightMostPathExtensionsFromSingle generates extensions for a given DFS code and graph, focusing on the rightmost path.

Parameters:

c – The parameter c is of type _ab.DFSCode, which seems to represent a Depth-First Search

code. It is used in the rightMostPathExtensionsFromSingle method to perform operations related to DFS codes :param g: The parameter g in the provided code snippet represents a graph object. It seems to be an instance of a graph data structure that contains vertices and edges. The code is designed to find and return extensions from a given DFS code c based on the provided graph g. The function ` :return: The function rightMostPathExtensionsFromSingle returns a dictionary extensions containing extended edges as keys and sets of graph IDs as values.

save(oFile)[source]

The save function writes information about frequent subgraphs to a specified output file in a specific format.

Parameters:

outputPath – The save method is used to write the results of frequent

subgraphs to a file specified by the outputPath parameter. The method iterates over each frequent subgraph in self.frequentSubgraphs and writes the subgraph information to the file

startMine()[source]

Run the gSpan algorithm.

subgraphIsomorphisms(c: DFSCode, g: Graph)[source]

The function subgraphIsomorphisms takes a DFS code and a graph as input, and finds all subgraph isomorphisms between the DFS code and the graph.

Parameters:

c – The parameter c in the subgraphIsomorphisms function is of type _ab.DFSCode, which

seems to represent a Depth-First Search code. :param g: The parameter g in the subgraphIsomorphisms function represents a graph object. The function is trying to find subgraph isomorphisms between a given DFS code c and the graph g. It iterates through the vertices of the graph starting with a specific :return: The function subgraphIsomorphisms returns a list of dictionaries, where each dictionary represents a subgraph isomorphism mapping between the input DFS code c and the input graph g. Each dictionary in the list maps vertex IDs from the DFS code to corresponding vertex IDs in the graph, indicating a valid subgraph isomorphism.

PAMI.subgraphMining.basic.sparseTriangularMatrix module

class PAMI.subgraphMining.basic.sparseTriangularMatrix.SparseTriangularMatrix[source]

Bases: object

getSupportForItems(i, j)[source]
incrementCount(i, j)[source]
removeInfrequentEntriesFromMatrix(minsup)[source]
setSupport(i, j, support)[source]

PAMI.subgraphMining.basic.vertex module

class PAMI.subgraphMining.basic.vertex.Vertex(id, vLabel)[source]

Bases: object

addEdge(edge)[source]
getEdgeList()[source]
getId()[source]
getLabel()[source]
removeEdge(edgeToRemove)[source]

Module contents