IterOrbit
Subgraph isomorphism with iterative graphlet-orbit filtering
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | List of all members
AppGraph Class Reference

#include <AppGraph.h>

Public Member Functions

void buildLabelIndex ()
 Builds label_index.
 
 AppGraph ()=default
 
 ~AppGraph ()
 
 AppGraph (const AppGraph &other)
 
AppGraph & operator= (const AppGraph &other)
 
 AppGraph (AppGraph &&other) noexcept
 
AppGraph & operator= (AppGraph &&other) noexcept
 
int get_node_idx (int node_id) const
 Internal index of a node ID, or -1 if the vertex is not in this graph.
 
int get_label_fast (int node_id) const
 Label of a node ID, or -1 if the vertex is not in this graph.
 
bool readFromFile (const std::string &filepath)
 Reads a graph in the "t / v / e" text format: a line v <id> <label> [...] per vertex and a line e <u> <v> [...] per undirected edge; other lines are ignored.
 
bool buildFromLabelsAndEdges (const std::vector< int > &vertex_labels, const std::vector< std::pair< int, int > > &edges)
 Builds the graph from memory.
 
int degree (int node_id) const
 Degree of a node ID in this graph (0 if absent).
 
bool hasEdge (int u, int v) const
 Whether node IDs u and v are adjacent in this graph.
 
std::vector< int > getNeighbors (int node_id) const
 Neighbours of a node ID, as node IDs.
 

Static Public Member Functions

static AppGraph createSubgraph (const AppGraph &original, const std::unordered_set< int > &node_subset)
 The subgraph of original induced by node_subset (node IDs): those vertices and every edge of original between two of them.
 
static AppGraph createSubgraph (const AppGraph &original, const std::vector< int > &sorted_ids)
 The same, for node IDs given sorted and without duplicates.
 

Public Attributes

Escape::CGraph * c_graph = nullptr
 Adjacency in CSR form, indexed by internal index; neighbour lists are sorted. Owned.
 
std::vector< int > original_node_ids
 Node IDs in ascending order; the position of an ID is its internal index.
 
std::vector< int > fast_node_to_idx
 Node ID -> internal index, or -1 if the vertex is not in this graph.
 
std::vector< int > fast_labels
 Node ID -> label, or -1 if the vertex is not in this graph.
 
std::shared_ptr< const LabelIndex > label_index
 Built by buildLabelIndex() (the data graph's); null otherwise. Shared by copies.
 

Private Member Functions

void build (const std::vector< int > &vertex_ids, const std::vector< int > &vertex_labels, const std::vector< std::pair< int, int > > &edges)
 
void clear ()
 
void copy_from (const AppGraph &other)
 

Constructor & Destructor Documentation

◆ AppGraph() [1/3]

AppGraph::AppGraph ( )
default

◆ ~AppGraph()

AppGraph::~AppGraph ( )

◆ AppGraph() [2/3]

AppGraph::AppGraph ( const AppGraph &  other)

◆ AppGraph() [3/3]

AppGraph::AppGraph ( AppGraph &&  other)
noexcept

Member Function Documentation

◆ build()

void AppGraph::build ( const std::vector< int > &  vertex_ids,
const std::vector< int > &  vertex_labels,
const std::vector< std::pair< int, int > > &  edges 
)
private

◆ buildFromLabelsAndEdges()

bool AppGraph::buildFromLabelsAndEdges ( const std::vector< int > &  vertex_labels,
const std::vector< std::pair< int, int > > &  edges 
)

Builds the graph from memory.

Vertex IDs are 0..vertex_labels.size()-1 and each undirected edge is listed once.

◆ buildLabelIndex()

void AppGraph::buildLabelIndex ( )

Builds label_index.

◆ clear()

void AppGraph::clear ( )
private

◆ copy_from()

void AppGraph::copy_from ( const AppGraph &  other)
private

◆ createSubgraph() [1/2]

AppGraph AppGraph::createSubgraph ( const AppGraph &  original,
const std::unordered_set< int > &  node_subset 
)
static

The subgraph of original induced by node_subset (node IDs): those vertices and every edge of original between two of them.

Node IDs and labels are kept.

◆ createSubgraph() [2/2]

AppGraph AppGraph::createSubgraph ( const AppGraph &  original,
const std::vector< int > &  sorted_ids 
)
static

The same, for node IDs given sorted and without duplicates.

◆ degree()

int AppGraph::degree ( int  node_id) const

Degree of a node ID in this graph (0 if absent).

◆ get_label_fast()

int AppGraph::get_label_fast ( int  node_id) const
inline

Label of a node ID, or -1 if the vertex is not in this graph.

◆ get_node_idx()

int AppGraph::get_node_idx ( int  node_id) const
inline

Internal index of a node ID, or -1 if the vertex is not in this graph.

◆ getNeighbors()

std::vector< int > AppGraph::getNeighbors ( int  node_id) const

Neighbours of a node ID, as node IDs.

◆ hasEdge()

bool AppGraph::hasEdge ( int  u,
int  v 
) const

Whether node IDs u and v are adjacent in this graph.

◆ operator=() [1/2]

AppGraph & AppGraph::operator= ( AppGraph &&  other)
noexcept

◆ operator=() [2/2]

AppGraph & AppGraph::operator= ( const AppGraph &  other)

◆ readFromFile()

bool AppGraph::readFromFile ( const std::string &  filepath)

Reads a graph in the "t / v / e" text format: a line v <id> <label> [...] per vertex and a line e <u> <v> [...] per undirected edge; other lines are ignored.

Returns false if the file cannot be opened.

Member Data Documentation

◆ c_graph

Escape::CGraph* AppGraph::c_graph = nullptr

Adjacency in CSR form, indexed by internal index; neighbour lists are sorted. Owned.

◆ fast_labels

std::vector<int> AppGraph::fast_labels

Node ID -> label, or -1 if the vertex is not in this graph.

◆ fast_node_to_idx

std::vector<int> AppGraph::fast_node_to_idx

Node ID -> internal index, or -1 if the vertex is not in this graph.

◆ label_index

std::shared_ptr<const LabelIndex> AppGraph::label_index

Built by buildLabelIndex() (the data graph's); null otherwise. Shared by copies.

◆ original_node_ids

std::vector<int> AppGraph::original_node_ids

Node IDs in ascending order; the position of an ID is its internal index.


The documentation for this class was generated from the following files: