Code Documentation 3.7
Social Network Visualizer
Loading...
Searching...
No Matches
Graph Class Reference

The Graph class This is the main class for a Graph, used in conjuction with GraphVertex, Parser and Matrix objects. Graph class methods are the interface to various analysis algorithms GraphVertex class holds each vertex data (colors, strings, statistics, etc) Matrix class holds the adjacency matrix of the network. Parser class loads files of networks. More...

#include <graph.h>

Inheritance diagram for Graph:
Collaboration diagram for Graph:

Classes

struct  GraphVisibilitySnapshot
struct  NodeConnectivityResult

Public Types

enum  ModStatus {
  NewNet = -1 , SavedUnchanged = 0 , MinorOptions = 1 , VertexMetadata = 2 ,
  EdgeMetadata = 3 , VertexPositions = 4 , MajorChanges = 10 , VertexCount = 11 ,
  EdgeCount = 12 , VertexEdgeCount = 13
}
enum  Clustering { Single_Linkage = 0 , Complete_Linkage = 1 , Average_Linkage = 2 }
enum class  NodeConnectivityStatus { Ok , Adjacent , Invalid }

Public Slots

int relationCurrent ()
 Gets the current relation number.
QString relationCurrentName () const
 Gets the current relation name.
void relationCurrentRename (const QString &newName)
 Overload. Renames current relation to newName, without emitting any signal to MW.
void relationCurrentRename (const QString &newName, const bool &signalMW)
 Renames current relation to newName, optionally emitting a signal to MW.
void vertexCreate (const int &number, const int &size, const QString &color, const QString &numColor, const int &numSize, const QString &label, const QString &labelColor, const int &labelSize, const QPointF &p, const QString &shape, const QString &iconPath=QString(), const bool &signalMW=false, const QHash< QString, QString > &customAttributes=QHash< QString, QString >())
 Creates a new vertex.
void graphFileLoaded (const int &fileType, const QString &fName=QString(), const QString &netName=QString(), const int &totalNodes=0, const int &totalLinks=0, const int &edgeDirType=0, const qint64 &elapsedTime=0, const QString &message=QString())
 Stores loaded file name, graph name, sets edge direction type and signals MW to update the UI.
void vertexRemoveDummyNode (int)
 Deletes a dummy node.
void graphLoadedTerminateParserThreads (QString reason)
 Graph::graphLoadedTerminateParserThreads.
void setSelectionChanged (const QList< int > selectedVertices, const QList< SelectedEdge > selectedEdges)
 Sets the user-selected vertices and edges.
void graphClickedEmptySpace (const QPointF &p)
 Resets the clicked edge and node.
bool edgeCreate (const int &v1, const int &v2, const qreal &weight, const QString &color, const int &type=0, const bool &drawArrows=true, const bool &bezier=false, const QString &label=QString(), const bool &signalMW=true, const QHash< QString, QString > &edgeCustomAttributes=QHash< QString, QString >())
 Checks if edge (v1,v2) already exists, then creates it and signals the UI to draw it.
void edgeCreateWebCrawler (const int &source, const int &target)
 Called from WebCrawler when it finds an new link Calls edgeCreate() method with initEdgeColor.
void vertexCreateAtPos (const QPointF &p)
 Creates a new vertex in the given position.
void vertexCreateAtPosRandom (const bool &signalMW=false)
 Creates a new randomly positioned vertex with default values.
void vertexCreateAtPosRandomWithLabel (const int &i, const QString &label, const bool &signalMW=false)
 Creates a new randomly positioned vertex with specific number and label. All other values are from the defaults.
void relationSet (int relNum=RAND_MAX, const bool &updateUI=true)
 Changes the current relation, and optionally emits signals to MW/GW (default: true).
void relationNext ()
 Changes graph to next relation.
void relationPrev ()
 Changes graph to previous relation.
void canvasSizeSet (const int &width, const int &height)
 Sets the size of the canvas.
void canvasSizeSetQuiet (const qreal &width, const qreal &height)
 Sets the canvas size without rescaling node positions.
double canvasMaxRadius () const
 Gets the max radius of the canvas.
qreal canvasMinDimension () const
 Gets the min dimensions of the canvas.
double canvasVisibleX (const double &x) const
 Checks if x is visible inside the canvas usable area and if not returns an adjusted x-coordinate.
double canvasVisibleY (const double &y) const
 Checks if y is visible inside the canvas usable area and if not returns an adjusted y-coordinate.
double canvasRandomX () const
 Returns a random x-coordinate adjusted to be visible inside the canvas usable area.
double canvasRandomY () const
 Returns a random y-coordinate adjusted to be visible inside the canvas usable area.
void vertexIsolatedAllToggle (const bool &toggle)
 Toggles the status of all isolated vertices (those without links).
void vertexClickedSet (const int &v, const QPointF &p)
 Sets the clicked vertex.
void edgeClickedSet (const int &v1, const int &v2, const bool &openMenu=false)
 Sets the clicked edge.
void vertexFilterByCentrality (const float threshold, const bool overThreshold, const IndexType centralityIndex)
 Filters vertices by their score on the given centrality or prestige index.
void vertexFilterByEgoNetwork (const int v1, const int depth=1)
 Saves current visibility state and shows only the ego network of vertex v1 at the given depth.
void vertexFilterBySelection (const QList< int > &selectedVertices)
 Saves current visibility state and shows only the selected vertices and the edges between them.
void vertexFilterByAttribute (const FilterCondition &cond)
 Shows only vertices whose custom attribute satisfies cond; all other vertices are hidden.
void edgeFilterByAttribute (const FilterCondition &cond)
 Hides all edges whose custom attribute does not satisfy cond.
void vertexFilterRestoreAll ()
 Restores vertex and edge visibility from the top snapshot on the history stack.
void vertexFilterRemoveAt (int stackIndex)
 Removes the filter at stackIndex (0 = oldest) and replays the rest.
QList< FilterSpecfilterSpecList () const
 Returns the FilterSpec list in application order (oldest first).
bool visibilityHistoryEmpty () const
 Returns true if the visibility history stack is empty.
void vertexFilterByQuery (const GraphQuery &query)
 Shows only vertices whose custom attributes satisfy ALL conditions in query.
void edgeFilterByQuery (const GraphQuery &query)
 Shows only edges whose custom attributes satisfy ALL conditions in query.
void edgeFilterByWeight (const qreal, const bool)
 Hides edges whose weight does not satisfy the threshold condition.
void edgeFilterReset ()
 Re-enables all edges in the current relation.
void edgeFilterUnilateral (const bool &toggle)
 Enables or disables unilateral edges in current relationship.
GraphsubgraphExtract (const QString &name, const bool &includeCustomAttributes=true)
 Extracts currently visible (non-filtered) nodes and their inter-edges into an independent Graph copy.
GraphsubgraphExtractFromSelection (const QString &name, const bool &includeCustomAttributes=true)
 Extracts currently selected nodes and their inter-edges into an independent Graph copy.
void startWebCrawler (const QUrl &startUrl, const QStringList &urlPatternsIncluded, const QStringList &urlPatternsExcluded, const QStringList &linkClasses, const int &maxNodes, const int &maxLinksPerPage, const bool &intLinks, const bool &childLinks, const bool &parentLinks, const bool &selfLinks, const bool &extLinksIncluded, const bool &extLinksCrawl, const bool &socialLinks, const bool &delayedRequests)
 Creates a new WebCrawler, that will parse the downloaded HTML code of each webpage we download. Moves the WebCrawler to a new thread and starts the thread. Then creates the fist node (initial url), and starts the web spider to download the first HTML page. Called by MW with user options.
void slotHandleCrawlerRequestReply ()
 Gets the reply of a MW network request made by Web Crawler, and emits that reply as is to the Web Crawler.
void webSpider ()
 A loop, that takes urls awaiting in front of the urlQueue, and signals to the MW to make the network request.
void slotCancelComputation ()
 Slot called by MainWindow when the user clicks Cancel in the progress dialog.
QString htmlEscaped (QString str) const
 Helper method, returns a nice qstring where all html special chars are encoded.

Signals

void signalWebCrawlParse (QNetworkReply *reply)
void signalNetworkManagerRequest (const QUrl &currentUrl, const NetworkRequestType &type)
void signalGraphSavedStatus (const int &status)
void signalGraphModified (const bool &undirected, const int &vertices, const int &edges, const qreal &density, const bool &notSaved=true)
void signalGraphLoaded (const int &fileType, const QString &fileName=QString(), const QString &netName=QString(), const int &totalNodes=0, const int &totalLinks=0, const qreal &density=0, const qint64 &elapsedTime=0, const QString &message=QString())
void statusMessage (const QString &message)
void signalDatasetDescription (QString)
void signalNodeClickedInfo (const int &number=0, const QPointF &p=QPointF(), const QString &label=QString(), const int &inDegree=0, const int &outDegree=0)
void signalEdgeClicked (const MyEdge &edge=MyEdge(), const bool &openMenu=false)
void signalRelationAddToMW (const QString &newRelation)
void signalRelationsClear ()
void signalRelationRenamedToMW (const QString &newRelName)
void signalRelationChangedToGW (int)
void signalRelationChangedToMW (const int &relIndex=RAND_MAX)
void signalGraphDirectedChanged (const bool &directed)
void signalSelectionChanged (const int &selectedVertices, const int &selectedEdges)
void signalPromininenceDistributionChartUpdate (QAbstractSeries *series, QAbstractAxis *axisX=Q_NULLPTR, const qreal &min=0, const qreal &max=0, QAbstractAxis *axisY=Q_NULLPTR, const qreal &minF=0, const qreal &maxF=0)
void signalDrawNode (const QPointF &p, const int &num, const int &size, const QString &nodeShape, const QString &nodeIconPath, const QString &nodeColor, const QString &numberColor, const int &numSize, const int &numDistance, const QString &label, const QString &labelColor, const int &labelSize, const int &labelDistance)
void signalRemoveNode (int)
void signalDrawEdge (const int &v1, const int &v2, const qreal &weight, const QString &label="", const QString &color="black", const int &type=0, const bool &drawArrows=true, const bool &bezier=false, const bool &weightNumbers=false)
void signalRemoveEdge (const int &v1, const int &v2, const bool &removeReverse)
void signalSetEdgeVisibility (const int &relation, const int &source, const int &target, const bool &toggle, const bool &preserveReverseEdge=false, const int &edgeWeight=1, const int &reverseEdgeWeight=1)
void signalSetEdgesVisibilityBatch (const QList< EdgeVisibilityChange > &changes)
void setVertexVisibility (const int &number, const bool &toggle)
void setNodePos (const int &, const qreal &, const qreal &)
void signalLayoutFinished ()
void signalNodesFound (const QList< int > foundList)
void setNodeSize (const int &v, const int &size)
void setNodeShape (const int &v, const QString &shape, const QString &iconPath=QString())
void setNodeColor (const int &v, const QString &color)
void setNodeLabel (const int &v, const QString &label)
void setNodeNumberColor (const int &v, const QString &color)
void setNodeNumberSize (const int &v, const int &size)
void setNodeNumberDistance (const int &v, const int &distance)
void setNodeLabelSize (const int &v, const int &size)
void setNodeLabelColor (const int &v, const QString &color)
void setNodeLabelDistance (const int &v, const int &distance)
void setEdgeWeight (const int &v1, const int &v2, const qreal &weight)
void signalEdgeType (const int &v1, const int &v2, const int &type)
void setEdgeColor (const int &v1, const int &v2, const QString &color)
void setEdgeLabel (const int &v1, const int &v2, const QString &label)
void addGuideCircle (const double &, const double &, const double &)
void addGuideHLine (const double &y0)

Public Member Functions

 Graph (const int &reserveVerticesSize=5000, const int &reserveEdgesPerVertexSize=500)
 Constructs a Graph.
 ~Graph ()
 Destroys the Graph object.
QThread * getThread () const
void moveToThreadFacade (QThread *thread)
void clear (const QString &reason="")
 Clears all vertices.
QString getFileName () const
 Returns the file name of the current graph, if any.
void setFileName (const QString &fileName)
 Sets the file name of the current graph.
QString getName () const
 Returns the name of the current graph.
void setName (const QString &graphName)
 Sets the name of the current graph.
bool isSaved () const
 Returns true if the graph is saved.
bool isLoaded () const
 Returns true if a graph has been loaded from a file.
int getFileFormat () const
 Returns the format of the last file opened.
void setFileFormat (const int &fileFormat)
bool isFileFormatExportSupported (const int &fileFormat) const
 Returns true if the fileFormat is supported for saving.
void setModStatus (const int &graphNewStatus, const bool &signalMW=true)
 Sets the graph modification status.
bool isModified () const
 Returns true of graph is modified (edges/vertices added/removed).
void loadFile (const QString fileName, const QString codecName, const int format, const QString delimiter=QString(), const int sm_two_mode=1, const bool sm_has_labels=false)
 Loads a graph from a given file.
void saveToFile (const QString &fileName, const int &fileType, const bool &saveEdgeWeights=true, const bool &saveZeroWeightEdges=false)
 Saves the current graph to a file.
bool saveToPajekFormat (const QString &fileName, QString networkName="", int maxWidth=0, int maxHeight=0)
 Save the current graph to a Pajek (.paj) file.
bool saveToAdjacencyFormat (const QString &fileName, const bool &saveEdgeWeights=true)
 Saves the active graph to an adjacency-formatted file.
bool saveToGraphMLFormat (const QString &fileName, const bool &saveZeroWeightEdges=false, QString networkName="", int maxWidth=0, int maxHeight=0)
 Saves the current graph to a GraphML-formatted file.
bool saveToDotFormat (const QString &fileName)
 Saves the active graph (current relation) to a GraphViz DOT file.
bool saveToUCINETDLFormat (const QString &fileName)
 Saves the current graph to a UCINET DL file (FULLMATRIX format).
bool saveToEdgeListWeightedFormat (const QString &fileName)
 Saves the active relation to a weighted edge list file.
bool saveToEdgeListSimpleFormat (const QString &fileName)
 Saves the active relation to a simple (unweighted) edge list file.
QString graphMatrixTypeToString (const int &matrixType) const
 Helper method, return the human readable name of matrix type.
int graphMatrixStrToType (const QString &matrix) const
 Helper method, return the matrix type of human readable matrix name .
QString graphMetricTypeToString (const int &metricType) const
 Helper method, return the human readable name of metric type.
int graphMetricStrToType (const QString &metricStr) const
 Helper method, return the identifier of a metric.
QString graphClusteringMethodTypeToString (const int &methodType) const
 Helper method, return the human readable name of clustering method type.
int graphClusteringMethodStrToType (const QString &method) const
 Helper method, return clustering method type from the human readable name of it.
int relations ()
 Returns the count of relationships in this Graph.
void relationsClear ()
 Clears relationships in this Graph.
void relationAdd (const QString &relName, const bool &changeRelation=false)
 Adds a new relation to the graph.
int vertexIndexByNumber (int v) const
 Returns the index of a vertex by its number.
GraphVertexvertexAtIndex (int idx)
 Returns the vertex at a given index.
const GraphVertexvertexAtIndex (int idx) const
 Returns the vertex at a given index.
VList::const_iterator verticesBegin () const
 iterator helpers
VList::const_iterator verticesEnd () const
int vertexNumberMax ()
 Returns the number of the last vertex in the graph.
int vertexNumberMin ()
 Returns the number of the first vertex in the graph.
int vertexDegreeOut (int)
 Returns the outDegree (sum of outbound edge weights) of vertex v1.
int vertexDegreeIn (int)
 Returns the inDegree (sum of inbound edge weights) of vertex v1.
QList< int > vertexReciprocalNeighborsList (const int &v1)
 Returns a list of all vertices reciprocally connected to vertex v1 in the current relation.
QSet< int > vertexReciprocalNeighborsSet (const int &v1)
 Returns the set of all vertices reciprocally connected to vertex v1 in the current relation.
QSet< int > vertexOutNeighborsSet (const int &v1, const bool includeInEdges=false)
 Returns the set of all 1-hop neighbors of vertex v1 in the current relation.
bool vertexIsolated (const int &v1) const
 Checks if vertex is isolated.
bool vertexExists (const int &v1)
 Checks if the given vertex exists in the graph.
int vertexIndexIfExists (const int &v1)
 Returns the internal position of the given vertex in m_graph, if it exists.
bool vertexExists (const QString &label)
 Checks if there is a vertex with a specific label in the graph.
int vertexIndexIfExists (const QString &label)
 Returns the internal position of the vertex with the given label, if it exists.
bool vertexFindByNumber (const QStringList &numList)
 Finds vertices in strList by their number.
bool vertexFindByLabel (const QStringList &labelList)
 Finds vertices by their label.
bool vertexFindByIndexScore (const int &index, const QStringList &thresholds, const bool &considerWeights, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Finds vertices by their index score.
void vertexRemove (const int &v1)
 Removes the vertex v1 from the graph First, it removes all edges to doomed from other vertices Then it changes the vpos of all subsequent vertices inside m_graph Finally, it removes the vertex.
void vertexSizeInit (const int)
 Sets the initial vertex size.
void vertexSizeSet (const int &v, const int &newsize)
 Changes the size of a vertex v or all vertices if v=0.
int vertexSize (const int &v) const
 Returns the size of vertex v.
void vertexShapeSetDefault (const QString, const QString &iconPath=QString())
 Sets the default vertex shape and iconPath.
void vertexShapeSet (const int &v, const QString &shape, const QString &iconPath=QString())
 Changes the shape and iconPath of vertex v1, or all vertices if v1=-1.
QString vertexShape (const int &v)
 Returns the shape of this vertex.
QString vertexShapeIconPath (const int &v)
 Returns the IconPath of vertex v1.
bool graphHasVertexCustomIcons () const
 Returns true if at least one vertex has a 'custom' shape (therefore a custom icon).
QStringList graphHasVertexCustomAttributes () const
 Returns true if at least one vertex has a 'custom' attribute.
void vertexColorInit (const QString &color)
 Graph::vertexColorInit default vertex color initialization.
void vertexColorSet (const int &v, const QString &color)
 Changes the color of vertex v1.
QColor vertexColor (const int &v) const
 Graph::vertexColor.
void vertexNumberColorInit (const QString &color)
 Changes the initial color of the vertex numbers.
void vertexNumberColorSet (const int &v=0, const QString &color="#000000")
 Graph::vertexColorSet Changes the color of vertex v1.
void vertexNumberSizeInit (const int &size)
 Changes the initial size of vertex numbers.
void vertexNumberSizeSet (const int &v, const int &newsize)
 Changes the size of vertex v number.
void vertexNumberDistanceInit (const int &distance)
 Changes the initial distance of vertex numbers.
void vertexNumberDistanceSet (const int &v, const int &newDistance)
 Changes the distance.of vertex v number from the vertex.
void vertexLabelSet (const int &v, const QString &label)
 Changes the label of a vertex v1.
QString vertexLabel (const int &v) const
 Returns the label of a vertex v1.
void vertexLabelsVisibilitySet (bool toggle)
void vertexLabelSizeInit (int newSize)
 Graph::vertexLabelSizeInit Changes the default size of vertex labels.
void vertexLabelSizeSet (const int &v, const int &labelSize)
 Changes the label size of vertex v1 or all vertices if v1=0.
void vertexLabelColorInit (QString color)
 Graph::vertexLabelColorInit Changes the default vertex label color.
void vertexLabelColorSet (const int &v1, const QString &color)
 Changes the label color of vertex v1 or all vertices if v1 = 0.
void vertexLabelDistanceInit (const int &distance)
 Changes the default distance of vertex labels.
void vertexLabelDistanceSet (const int &v, const int &newDistance)
 Changes the distance.of vertex v label from the vertex.
void vertexLabelDistanceAllSet (const int &newDistance)
 Changes the distance of all vertex labels from their vertices.
void vertexCustomAttributesSet (const int &v1, const QHash< QString, QString > &customAttributes)
 Sets custom attributes for a specified vertex.
void vertexCustomAttributeSet (const int &v1, const QString &key, const QString &value)
 Sets a single custom attribute key/value on vertex v1, leaving all other attributes untouched.
void vertexCustomAttributeRemove (const int &v1, const QString &key)
 Removes a single custom attribute key from vertex v1. Does nothing if the key does not exist.
QHash< QString, QString > vertexCustomAttributes (const int &v1) const
 Retrieves the vertex at the position specified by the index v1 from the vpos map and calls its customAttributes method.
int vertexAttributesImport (const QStringList &headers, const QVector< QStringList > &rows, int idColumn, bool matchByLabel)
 Imports custom attributes from a parsed table into existing vertices.
void vertexPosSet (const int &v, const int &x, const int &y)
 Changes the position of the given vertex.
QPointF vertexPos (const int &v1) const
 Returns the position of the given vertex.
int vertexClicked () const
 Returns the number of the clicked vertex.
int vertices (const bool &dropIsolates=false, const bool &countAll=false, const bool &recount=false)
 Gets the number of vertices in the graph.
int vertexEdgesOutbound (int i)
 Returns the number of outbound edges (arcs) from vertex v1.
int vertexEdgesInbound (int i)
 Returns the number of inbound edges (arcs) to vertex v1.
int verticesWithOutboundEdges ()
 Returns the sum of vertices having edgesOutbound.
int verticesWithInboundEdges ()
 Returns the sum of vertices having edgesInbound.
int verticesWithReciprocalEdges ()
 Returns the sum of vertices having reciprocal edges.
QList< int > verticesListIsolated ()
 Returns a list of all isolated vertices inside the graph.
QList< int > verticesList ()
 Returns a list of all vertices numbers inside the graph.
QSet< int > verticesSet ()
 Returns a QSet of all vertices numbers inside the graph.
void verticesCreateSubgraph (QList< int > vList, const int &type=SUBGRAPH_CLIQUE, const int &center=0)
 Creates a subgraph (clique, star, cycle, line) with vertices in vList Iff vList is empty, then fallbacks to the m_verticesSelected.
GraphVertexvertexPtr (const int v)
int edgesEnabled ()
 Returns the number of enabled ties in the current relation.
MyEdge edgeClicked ()
 Returns clicked edge.
qreal edgeExists (const int &v1, const int &v2, const bool &checkReciprocal=false)
 Checks if there is an edge from v1 to v2 and returns the weight, if the edge exists.
qreal edgeExistsVirtual (const int &v1, const int &v2)
 Checks if there is an edge from v1 to v2, even weight = 0 and returns the weight, if the edge exists or RAND_MAX if the edge does not exist at all.
void edgeOutboundStatusSet (const int &source, const int &target, const bool &toggle=false)
 Toggles the status of outbound edge source -> target at source vertex.
void edgeInboundStatusSet (const int &target, const int &source, const bool &toggle=false)
 Toggles the status of inbound edge target <- source at target vertex.
void notifyEdgeVisibilityChanged (const int &relation, const int &source, const int &target, const bool &toggle, const bool &preserveReverseEdge=false, const int &edgeWeight=1, const int &reverseEdgeWeight=1)
 Plain relay to signalSetEdgeVisibility, for GraphVertex (a QtCore-only value class, not a QObject) to notify the UI layer of a single edge's visibility change. See #WS3 M2.
void notifyEdgesVisibilityBatch (const QList< EdgeVisibilityChange > &changes)
 Plain relay to signalSetEdgesVisibilityBatch, for GraphVertex to notify the UI layer of many edges' visibility changes as a single queued dispatch. See #WS3 M2.
void edgeRemove (const int &v1, const int &v2, const bool &removeReverse=false)
 Removes the directed arc v1->v2 or, if the graph is undirected, the edge v1 <->v2.
void edgeRemoveSelected (SelectedEdge &selectedEdge, const bool &removeReverse)
 Removes a SelectedEdge.
void edgeRemoveSelectedAll ()
 Removes all selected edges.
bool edgeSymmetric (const int &v1, const int &v2)
 Returns TRUE if edge(v1, v2) is symmetric, i.e. (v1,v2) == (v2,v1).
void edgeTypeSet (const int &v1, const int &v2, const qreal &w, const int &dirType=EdgeType::Directed)
 Changes the direction type of an existing edge.
void edgeWeightSet (const int &v1, const int &v2, const qreal &w, const bool &undirected=false)
 Changes the weight of the edge from vertex v1 to v2 (and optionally of the reverse edge).
qreal edgeWeight (const int &v1, const int &v2) const
 Returns the weight of the edge v1->v2.
void edgeWeightNumbersVisibilitySet (const bool &toggle)
 Changes the visibility of edge weight numbers.
void edgeLabelSet (const int &v1, const int &v2, const QString &label)
 Changes the label of edge v1->v2.
QString edgeLabel (const int &v1, const int &v2) const
 Returns the label of edge v1->v2.
void edgeLabelsVisibilitySet (const bool &toggle)
 Toggles the visibility of edge labels.
void edgeColorInit (const QString &)
 Saves the default edge color Used by random network creation methods.
void edgeColorZeroInit (const QString &)
void showZeroWeightEdgesSet (const bool &toggle)
void edgeColorSet (const int &v1, const int &v2, const QString &color)
 Changes the color of edge v1->v2.
QString edgeColor (const int &v1, const int &v2)
 Returns the color of the directed edge v1->v2.
bool edgeColorAllSet (const QString &color, const int &threshold=RAND_MAX)
 Changes the color of all enabled edges.
void edgeCustomAttributesSet (const int &v1, const int &v2, const QHash< QString, QString > &attrs)
 Sets all custom attributes on edge v1→v2, replacing any previously stored attributes for that edge.
QHash< QString, QString > edgeCustomAttributes (const int &v1, const int &v2) const
 Returns the custom attributes stored on edge v1→v2. Returns an empty hash if no attributes have been set for that edge.
int edgeAttributesImport (const QStringList &headers, const QVector< QStringList > &rows, int srcColumn, int tgtColumn)
 Imports custom attributes from a parsed table into existing edges.
QStringList graphHasEdgeCustomAttributes () const
 Returns a list of all unique custom attribute keys present across all enabled edges in the current graph.
bool isEmpty () const
 Returns true if the current graph has no vertices at all.
QList< int > getSelectedVertices () const
 Returns a QList of user-selected vertices.
int getSelectedVerticesCount () const
 Returns count of user-selected vertices.
int getSelectedVerticesMin () const
 Returns min of user-selected vertices.
int getSelectedVerticesMax () const
 Returns max of user-selected vertices.
QList< SelectedEdgegetSelectedEdges () const
 Returns a QList of user-selected edges in pair<int,int>.
int getSelectedEdgesCount () const
 Returns the count of user-selected edges.
int getGeodesicsCount ()
 Returns the number of geodesics (shortest-paths) in the graph.
qreal graphDensity ()
 Gets the graph density (if computed) or computes it again.
bool isWeighted ()
 Returns true if the current relation has at least one edge with weight other than 0 or 1 (i.e. the relation is valued/weighted).
bool isAnyRelationWeighted ()
 Returns true if any relation in the graph has at least one edge with weight other than 0 or 1.
void setWeighted (const bool &toggle=true)
 Sets the graph to be weighted ( valued edges ).
qreal graphReciprocity ()
 Gets the arc reciprocity of the graph.
bool isSymmetric ()
 Returns TRUE if the adjacency matrix of the current relation is symmetric.
void setSymmetric ()
 Transforms the graph to symmetric (all edges reciprocal).
void addRelationSymmetricStrongTies (const bool &allRelations=false)
 Creates a new symmetric relation by keeping only strong-ties (mutual links) in the current relation. In the new relation, two actors are connected only if they are mutually connected in the current relation.
void relationAddCocitation ()
 Creates a new symmetric relation by connecting those actors that are cocitated by others. In the new relation, an edge will exist between actor i and actor j only if C(i,j) > 0, where C the Cocitation Matrix. Thus the actor pairs cited by more common neighbors will appear with a stronger tie between them than pairs those cited by fewer common neighbors. The resulting relation is symmetric.
void graphDichotomization (const qreal threshold)
 Creates a new binary relation in a valued network using edge dichotomization according to the threshold parameter.
void setDirected (const bool &toggle=true, const bool &signalMW=true)
 Toggles the graph directed or undirected.
void setUndirected (const bool &toggle=true, const bool &signalMW=true)
 Makes the graph undirected or directed.
bool isDirected ()
 Returns true if graph is directed.
bool isUndirected ()
 Returns true if graph is undirected.
bool isConnected ()
 Checks if the graph is connected, in the sense of a topological space, i.e., there is a path from any vertex to any other vertex in the graph.
bool isConnectedCached () const
 Returns true if the graph is connected, without recalculating it.
int graphWeaklyConnectedComponents ()
 Counts weakly connected components using BFS.
int graphWeaklyConnectedComponentsCached () const
int graphStronglyConnectedComponents ()
 Counts strongly connected components using Tarjan's algorithm.
int graphStronglyConnectedComponentsCached () const
const QHash< int, int > & vertexComponentId () const
NodeConnectivityResult graphNodeConnectivity (int source, int target, bool respectDirection)
 Local vertex connectivity kappa(source, target): the minimum number of nodes, other than source and target themselves, whose removal disconnects target from source.
int graphConnectivity (bool respectDirection)
 Global vertex connectivity kappa(G): the minimum, over every non-adjacent pair of vertices, of their local vertex connectivity (graphNodeConnectivity()) - the network's worst-case robustness to node removal, i.e. the fewest nodes that would need to be removed to disconnect the network at its weakest point.
MatrixmatrixAdjacency ()
MatrixmatrixAdjacencyInverse ()
MatrixmatrixDistances ()
MatrixmatrixReachability ()
MatrixmatrixWalks ()
MatrixmatrixTotalWalks ()
MatrixmatrixCliqueCoMembership ()
void createMatrixAdjacency (const bool dropIsolates=false, const bool considerWeights=true, const bool inverseWeights=false, const bool symmetrize=false)
 Creates an adjacency matrix AM where AM(i,j)=1 if i is connected to j and AM(i,j)=0 if i not connected to j.
bool createMatrixAdjacencyInverse (const QString &method="lu")
 Computes the inverse of the current adjacency matrix.
void createMatrixSimilarityMatching (Matrix &AM, Matrix &SEM, const int &measure=METRIC_SIMPLE_MATCHING, const QString &varLocation="Rows", const bool &diagonal=false, const bool &considerWeights=true)
 Calls Matrix:similarityMatrix to compute the similarity matrix SCM of the variables (rows, columns, both) in given input matrix using the selected matching measure.
void createMatrixSimilarityPearson (Matrix &AM, Matrix &PCC, const QString &varLocation="Rows", const bool &diagonal=false)
 The Pearson product-moment correlation coefficient (PPMCC, PCC or Pearson's r) is a measure of the linear dependence between two variables X and Y.
void createMatrixDissimilarities (Matrix &INPUT_MATRIX, Matrix &DSM, const int &metric, const QString &varLocation, const bool &diagonal, const bool &considerWeights)
 Calls Matrix:distancesMatrix to compute the dissimilarities matrix DSM of the variables (rows, columns, both) in given input matrix using the user defined metric.
void setReportsDataDir (const QString &reportsDir)
 Sets the directory where reports are saved This is used when exporting prominence distribution images to be used in HTML reports.
void setReportsRealNumberPrecision (const int &precision)
 Sets the precision (number of fraction digits) the app will use when writing real numbers in reports.
void setReportsLabelLength (const int &length)
 Sets the length of labels in reports.
void setReportsChartType (const int &type)
 Sets the chart type in reports.
void setReportsOutputFormat (const int &format)
 Sets the output format (HTML or CSV) new reports are written in.
void writeDataSetToFile (const QString dir, const QString)
 Writes a "famous" dataset to the given file Datasets are hardcoded! They are exported in the given fileName...
void writeMatrixAdjacencyTo (QTextStream &os, const bool &saveEdgeWeights=true)
bool writeReciprocity (const QString fileName, const bool considerWeights=false, const int &format=ReportFormat::Html)
 Writes reciprocity report to filename.
bool writeMatrix (const QString &fileName, const int &matrix=MATRIX_ADJACENCY, const bool &considerWeights=true, const bool &inverseWeights=false, const bool &dropIsolates=false, const QString &varLocation="Rows", const bool &simpler=false, const int &format=ReportFormat::Html)
 Computes and writes the specified matrix of the social network to an HTML report file.
void writeMatrixHTMLTable (QTextStream &outText, Matrix &M, const bool &markDiag=true, const bool &plain=false, const bool &printInfinity=true, const bool &dropIsolates=false)
 Writes the matrix M as HTML.
void writeMatrixCSVTable (QTextStream &outText, Matrix &M, const bool &printInfinity=true, const bool &dropIsolates=false)
 Writes the matrix M as a comma-separated table to the specified text stream outText.
bool writeMatrixAdjacency (const QString fileName, const bool &markDiag=true, const int &format=ReportFormat::Html)
void writeMatrixAdjacencyPlot (const QString fileName, const bool &simpler=false)
 Writes a visual representation of the adjacency matrix of the graph to the specified file.
bool writeMatrixDissimilarities (const QString fileName, const QString &metricStr, const QString &varLocation, const bool &diagonal, const bool &considerWeights, const int &format=ReportFormat::Html)
 Writes dissimilarity matrix based on a metric/measure to given html file.
bool writeMatrixSimilarityMatching (const QString fileName, const QString &measure="Simple", const QString &matrix="adjacency", const QString &varLocation="rows", const bool &diagonal=false, const bool &considerWeights=true, const int &format=ReportFormat::Html)
 Writes similarity matrix based on a matching measure to given html file.
bool writeMatrixSimilarityPearson (const QString fileName, const bool considerWeights, const QString &matrix="adjacency", const QString &varLocation="rows", const bool &diagonal=false, const int &format=ReportFormat::Html)
 Calls Graph::createMatrixSimilarityPearson() and writes Pearson Correlation Coefficients to given file.
bool writeEccentricity (const QString fileName, const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false, const int &format=ReportFormat::Html)
 Writes the Eccentricity report to file.
void writeScoreTableHTML (QTextStream &outText, const QStringList &dataColumnHeaders, const std::function< QVector< qreal >(GraphVertex *)> &rowValues, const std::function< bool(GraphVertex *)> &isBlanked=nullptr, const std::function< bool(GraphVertex *)> &isSkipped=nullptr)
 Renders a per-node score table as a sortable HTML.
void writeScoreTableCSV (QTextStream &outText, const QStringList &dataColumnHeaders, const std::function< QVector< qreal >(GraphVertex *)> &rowValues, const std::function< bool(GraphVertex *)> &isBlanked=nullptr, const std::function< bool(GraphVertex *)> &isSkipped=nullptr)
 CSV sibling of writeScoreTableHTML() - same column shape and semantics, comma-delimited, no HTML markup, same RAND_MAX-as-infinity convention. Reuses TableExport::csvQuote() for the Label column, the only free-text field (Node numbers and scores are always numeric, so they never need escaping).
bool writeCentralityDegree (const QString, const bool weights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the Degree Centrality to a file.
bool writeCentralityCloseness (const QString, const bool weights, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the closeness centralities to a file.
bool writeCentralityClosenessInfluenceRange (const QString, const bool weights, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the "improved" closeness centrality indices to a file.
bool writeCentralityBetweenness (const QString, const bool weights, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes Betweenness centralities to file.
bool writeCentralityPower (const QString, const bool weigths, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes Power Centralities to a file.
bool writeCentralityStress (const QString, const bool weigths, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the Stress centralities to a file.
bool writeCentralityEccentricity (const QString, const bool weigths, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the Eccentricity centralities (aka Harary Graph Centrality) to a file.
bool writeCentralityInformation (const QString, const bool weigths, const bool inverseWeights, const int &format=ReportFormat::Html)
 Writes the information centralities to file.
bool writeCentralityEigenvector (const QString, const bool &weigths=true, const bool &inverseWeights=false, const bool &dropIsolates=false, const int &format=ReportFormat::Html)
 Writes the eigenvector centralities to a file.
bool writeCentralityKatz (const QString, const qreal &alpha, const bool &weigths=false, const bool &inverseWeights=false, const bool &dropIsolates=false, const int &format=ReportFormat::Html)
 Writes the Katz Centrality report to a file, then displays it.
bool writeCentralityBonacich (const QString, const qreal &alpha, const qreal &beta, const bool &weigths=false, const bool &inverseWeights=false, const bool &dropIsolates=false, const int &format=ReportFormat::Html)
bool writePrestigeDegree (const QString, const bool weights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the Degree Prestige of each node to a file.
bool writePrestigeProximity (const QString, const bool weights, const bool inverseWeights, const bool dropIsolates, const int &format=ReportFormat::Html)
 Writes the proximity prestige indices to a file.
bool writePrestigePageRank (const QString, const bool Isolates=false, const int &format=ReportFormat::Html)
 Writes the PageRank scores of vertices to a file.
bool writeClusteringHierarchical (const QString &fileName, const QString &varLocation, const QString &matrix="Adjacency", const QString &metric="Manhattan", const QString &method="Complete", const bool &diagonal=false, const bool &dendrogram=false, const bool &considerWeights=true, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Performs Hierarchical Cluster Analysis (HCA) and writes the results to an HTML report file.
void writeClusteringHierarchicalResultsToStream (QTextStream &outText, const int N, const bool &dendrogram=false)
 Writes Hierarchical Clustering results to given output stream Before running this method, the method Graph::graphClusteringHierarchical() must execute and return true. Otherwise, the result is unpredictable...
bool writeCliqueCensus (const QString &fileName, const bool considerWeights)
 Calls graphCliques() to compute all cliques (maximal connected subgraphs) of the network. Then writes the results into a file, along with the Actor by clique analysis, the Co-membership matrix and the Hierarchical clustering of overlap matrix.
bool writeClusteringCoefficient (const QString, const bool, const int &format=ReportFormat::Html)
 Writes the clustering coefficients to a file.
bool writeTriadCensus (const QString, const bool, const int &format=ReportFormat::Html)
int graphConnectednessFull (const bool updateProgress=false)
bool graphReachable (const int &v1, const int &v2)
 Returns true if vertices v1 and v2 are reachable.
void createMatrixReachability ()
 Creates the reachability matrix XRM.
int graphDiameter (const bool considerWeights, const bool inverseWeights)
 Returns the diameter of the graph, aka the largest geodesic distance between any two vertices.
int graphDiameterCached () const
 Returns the number of geodesics (shortest paths) in the graph, without recalculating it.
qreal graphSumDistanceCached () const
 Returns the sum of all finite geodesic distances accumulated by DistanceEngine, without recalculating anything.
qreal graphGeodesicsCountCached () const
 Returns the number of geodesics (shortest paths) accumulated by DistanceEngine, without recalculating anything.
int graphDistanceGeodesic (const int &v1, const int &v2, const bool &considerWeights=false, const bool &inverseWeights=true)
 Returns the geodesic distance (length of shortest path) from vertex v1 to vertex v2.
qreal apspDistance (const int &v1, const int &v2)
 Returns the already-computed geodesic distance from vertex v1 to vertex v2, for the current relation, without triggering a recompute (unlike graphDistanceGeodesic() above). RAND_MAX if either vertex is unknown or nothing has been computed yet for this relation.
int apspShortestPaths (const int &v1, const int &v2)
 Returns the already-computed number of shortest paths from vertex v1 to vertex v2, for the current relation, without triggering a recompute. 0 if either vertex is unknown or nothing has been computed yet for this relation.
QMap< int, int > graphGeodesicDistanceDistribution (const bool &considerWeights=false, const bool &inverseWeights=false)
 Returns a histogram of geodesic distances across all ordered vertex pairs.
bool writeGeodesicDistribution (const QString &fileName, const bool &considerWeights=false, const bool &inverseWeights=false)
 Writes a geodesic distance distribution report to an HTML file.
QList< int > graphGeodesicShortestPath (const int &v1, const int &v2, const bool &considerWeights=false, const bool &inverseWeights=false)
 Reconstructs one shortest path from vertex v1 to vertex v2.
qreal graphDistanceGeodesicAverage (const bool considerWeights, const bool inverseWeights, const bool dropIsolates)
 Returns the average distance of the graph.
qreal graphDistanceGeodesicAverageCached () const
 Returns the average geodesic distance of the graph, without recalculating it.
void graphDistancesGeodesic (const bool &computeCentralities=false, const bool &considerWeights=false, const bool &inverseWeights=true, const bool &dropIsolates=false)
 Computes the geodesic distances between all vertices: In the process, it also computes many other centrality/prestige metrics:
void notConnectedPairsClear ()
void notConnectedPairsInsert (int from, int to)
int notConnectedPairsSize () const
void resetDistanceCentralityCacheFlags ()
void setSymmetricCached (bool v)
bool symmetricCached () const
void setConnectedCached (bool v)
void setDiameterCached (int v)
void resetDistanceAggregates ()
void addToDistanceSum (qreal delta)
void incGeodesicsCount ()
void addGeodesicsCount (int n)
void setAverageDistanceCached (qreal v)
bool graphMatrixDistanceGeodesicCreate (const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Creates the matrix DM of geodesic distances between vertices.
void graphMatrixShortestPathsCreate (const bool &considerWeights=false, const bool &inverseWeights=true, const bool &dropIsolates=false)
 Creates the matrix SIGMA of shortest paths (geodesics) between vertices Each SIGMA(i,j) is the number of shortest paths (geodesics) from i and j.
int getProminenceIndexByName (const QString &prominenceIndexName)
 Returns the IndexType of the given prominence index name Called from MW::slotEditNodeFind, MW::slotLayoutRadialByProminenceIndex etc.
void prominenceDistribution (const int &index, const ChartType &type, const QString &distImageFileName=QString())
 Computes the distribution of a centrality index score. The distribution is stored as Qt Series depending on the SeriesType parameter type It is send to MW through signal/slot.
void prominenceDistributionBars (const H_StrToInt &discreteClasses, const QString &name, const QString &distImageFileName)
 Computes the prominence distribution and delegates Bar chart rendering.
void prominenceDistributionArea (const H_StrToInt &discreteClasses, const QString &name, const QString &distImageFileName)
 Computes prominence distribution data and delegates Area chart rendering.
void prominenceDistributionSpline (const H_StrToInt &discreteClasses, const QString &seriesName, const QString &distImageFileName)
 Computes prominence distribution data and delegates Spline chart rendering.
void centralityDegree (const bool &considerWeights=true, const bool &dropIsolates=false)
 Calculates the degree (outDegree) centrality of each vertex - diagonal included.
void centralityInformation (const bool considerWeights=false, const bool inverseWeights=false)
 Computes the Information centrality of each vertex - diagonal included Note that there is no known generalization of Stephenson & Zelen's theory for information centrality to directional data.
void centralityEigenvector (const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Computes Eigenvector centrality.
qreal estimateSpectralRadius (const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Estimates the adjacency matrix's spectral radius (dominant eigenvalue magnitude).
void centralityKatz (const qreal &alpha, const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Computes Katz Centrality of each vertex, with attenuation factor alpha.
void centralityBonacich (const qreal &alpha, const qreal &beta, const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Computes Bonacich Power Centrality of each vertex, with parameters alpha and beta.
void centralityClosenessIR (const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false)
 Computes an "improved" closeness centrality index, IRCC, which can be used on disconnected graphs. IRCC is an improved node-level centrality closeness index which focuses on the influence range of each node (the set of nodes that are reachable from it) For each node v, this index calculates the fraction of nodes in its influence range and divides it by the average distance of those nodes from v, ignoring nodes that are not reachable from it.
void prestigeDegree (const bool &considerWeights, const bool &dropIsolates=false)
 Computes the Degree Prestige (in-degree) of each vertex - diagonal included Also the mean value and the variance of the in-degrees.
void prestigePageRank (const bool &dropIsolates=false)
 Calculates the PageRank Prestige of each vertex.
void prestigeProximity (const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false)
 Computes Proximity Prestige of each vertex Also the mean value and the variance of it..
bool isCentralityIndexComputed (const IndexType index) const
 Returns true if the given centrality/prestige index has been computed.
int walksBetween (int v1, int v2, int length)
 Calculates and returns the number of walks of a given length between v1 and v2.
void graphWalksMatrixCreate (const int &N=0, const int &length=0, const bool &dropIsolates=false, const bool &considerWeights=false, const bool &inverseWeights=false, const bool &symmetrize=false)
 Computes either the "Walks of given length" or the "Total Walks" matrix. If length>0, it computes the Walks of given length matrix, XM=AM^l where each element (i,j) denotes the number of walks of length l between vertex i and j. If length=0, it computes the Total Walks matrix, XSM=Sum{AM^n} where each (i,j) denotes the total number of walks of any length between vertices i and j. NOTE: In the latter case, this function is VERY SLOW on large networks (n>50), since it will calculate all powers of the sociomatrix up to n-1 in order to find out all possible walks.
bool writeMatrixWalks (const QString &fn, const int &length=0, const bool &simpler=false, const int &format=ReportFormat::Html)
 Writes the walks of given length matrix to a file in HTML. If length = 0, it writes the Total Walks matrix.
qreal numberOfTriples (int v1)
void graphCliques (QSet< int > R=QSet< int >(), QSet< int > P=QSet< int >(), QSet< int > X=QSet< int >())
 Finds all maximal cliques in the graph using the Bron–Kerbosch algorithm with Tomita et al. (2006) pivot selection.
void graphCliqueAdd (const QList< int > &clique)
 Called from Graph::graphCliques to add a new clique (list of vertices) Adds clique info to each clique member and updates co-membership matrix CLQM .
int graphCliquesContaining (const int &actor, const int &size=0)
int graphCliquesOfSize (const int &size)
 Graph::graphCliquesOfSize Returns the number of maximal cliques of a given size.
bool graphClusteringHierarchical (Matrix &STR_EQUIV, const QString &varLocation, const int &metric, const int &method, const bool &diagonal=false, const bool &diagram=false, const bool &considerWeights=true, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Performs an hierarchical clustering process (Johnson, 1967) on a given NxN distance/dissimilarity matrix. The input matrix can be the the adjacency matrix, the geodesic distance matrix or a derived from them dissimilarities matrix using a user-specified metric, i.e. euclidean distance. The method parameter defines how to compute distances (similarities) between a new cluster the old clusters. Valid values can be:
qreal clusteringCoefficientLocal (const int &v1)
 Returns the local clustering coefficient (CLUCOF) of vertex v1.
qreal clusteringCoefficient ()
 Computes local clustering coefficients and returns the network average Clustering Coefficient.
bool graphTriadCensus ()
 Conducts a triad census and updates QList::triadTypeFreqs, which is the list carrying all triad type frequencies Complexity: O(n³) — three nested loops each bounded by N.
void triadType_examine_MAN_label (int, int, int, GraphVertex *, GraphVertex *, GraphVertex *)
const QList< int > & graphTriadTypeFreqs () const
bool hasCalculatedTriadCensus () const
void layoutRandom ()
 Repositions all nodes on random positions Emits setNodePos(i, x,y) to tell GW that the node item should be moved.
void layoutRadialRandom (const bool &guides=true)
 Repositions all nodes on the periphery of different circles with random radius.
void layoutEgoRadial (const int egoVertex)
 Ego-centered radial layout.
void layoutCircular (const double &x0, const double &y0, const double &newRadius, const bool &guides=false)
 Repositions all nodes on the periphery of a circle with given radius.
void layoutByProminenceIndex (int prominenceIndex, int layoutType, const bool &considerWeights=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
 Applies a layout according to each actor's prominence index score. The layout type can be radial (0), level (1), node sizes (2) or node colors (3), as follows: layoutType=0 - Repositions all nodes on the periphery of concentric circles with radius analogous to their prominence index layoutType=1 - Repositions all nodes on different top-down levels according to their centrality layoutType=2 - Changes node sizes to be proportional to their prominence index score layoutType=2 - Changes node colors to reflect their prominence index score (from red to green).
void layoutVertexSizeByIndegree ()
 Convenience method Changes the size of all nodes to be proportional to their InDegree (Degree Prestige) Calls layoutByProminenceIndex.
void layoutVertexSizeByOutdegree ()
 Convenience method Changes the size of all nodes to be proportional to their outDegree (Degree Centrality) Calls layoutByProminenceIndex.
void layoutForceDirectedSpringEmbedder (const int maxIterations)
 Embeds a Force Directed Placement layout according to the initial Spring Embedder model proposed by Eades.
void layoutForceDirectedFruchtermanReingold (const int maxIterations)
 Embeds a Force Directed Placement layout according to the Fruchterman-Reingold model. Fruchterman and Reingold (1991) refined the Spring Embedder model by replacing the forces. In this model, "the vertices behave as atomic particles or celestial bodies, exerting attractive and repulsive forces on one another." (ibid). Again, only vertices that are neighbours attract each other but, unlike Spring Embedder, all vertices repel each other. These forces induce movement. The algorithm might resemble molecular or planetary simulations, sometimes called n-body problems.
void layoutForceDirectedKamadaKawai (const int maxIterations=500, const bool considerWeights=false, const bool inverseWeights=false, const bool dropIsolates=false, const QString &initialPositions="current")
 Embeds a Force Directed Placement layout according to the Kamada-Kawai model. In this model, the network is considered to be a dynamic system where every two actors are 'particles' mutually connected by a 'spring'. Each spring has a desirable length, which corresponds to their graph theoretic distance. In this way, the optimal layout of the graph is the state with the minimum imbalance. The degree of imbalance is formulated as the total spring energy: the square summation of the differences between desirable distances and real ones for all pairs of particles Initially, the particles/actors are placed on the vertices of a regular n-polygon.
qreal graphDistanceEuclidean (const QPointF &a, const QPointF &b)
 Computes the euclideian distance between QPointF a and b.
qreal graphDistanceEuclidean (const QPointF &a)
 the euclideian distance of QPointF a (where a is difference vector)
int sign (const qreal &D)
 Graph::sign returns the sign of number D as integer (1 or -1).
qreal layoutForceDirected_F_rep (const QString model, const qreal &dist, const qreal &optimalDistance)
 Computes the repulsive force between two vertices for force-directed layouts.
qreal layoutForceDirected_F_att (const QString model, const qreal &dist, const qreal &optimalDistance)
 Computes the attractive (spring) force between two adjacent vertices.
qreal layoutForceDirected_Eades_moveNodes (const qreal &c4)
 Moves all vertices to their new positions as computed by the Eades Spring Embedder model.
qreal layoutForceDirected_FR_moveNodes (const qreal &temperature)
 Moves all vertices to their new positions as computed by the Fruchterman-Reingold model.
qreal layoutForceDirected_FR_temperature (const int iteration) const
 Reduces the temperature as the layout approaches a better configuration.
qreal computeOptimalDistance (const int &V)
 Computes the optimal inter-vertex distance for force-directed layouts.
void compute_angles (const QPointF &Delta, const qreal &dist, qreal &angle1, qreal &angle2, qreal &degrees1, qreal &degrees2)
 Graph::compute_angles Computes the two angles of the orthogonal triangle shaped by two points of difference vector DV and distance dist A = 90 B = angle1 C = angle2.
void webCrawlTerminateThreads (QString reason)
 called from Graph, when closing network, to terminate all crawler processes Also called indirectly when wc_spider finishes
void randomizeThings ()
 Adds a little universal randomness :).
bool randomNetErdosCreate (const int &N, const QString &model, const int &m, const qreal &p, const QString &mode, const bool &diag)
 Creates an Erdős–Rényi random network.
bool randomNetScaleFreeCreate (const int &N, const int &power, const int &m0, const int &m, const qreal &alpha, const QString &mode)
 Creates a Barabási–Albert scale-free random network.
bool randomNetSmallWorldCreate (const int &N, const int &degree, const double &beta, const QString &mode)
 Creates a Watts–Strogatz small-world random network.
bool randomNetRingLatticeCreate (const int &N, const int &degree, const bool updateProgress=false)
 Creates a random ring lattice network.
bool randomNetRegularCreate (const int &N, const int &degree, const QString &mode, const bool &diag)
 Creates a pseudo-random d-regular network.
bool randomNetLatticeCreate (const int &N, const int &length, const int &dimension, const int &nei, const QString &mode, const bool &circular)
 Creates a lattice (mesh/grid) random network.
int factorial (int)
bool progressCanceled () const
 Returns true if the user has requested cancellation via the progress dialog.
void resetProgressCanceled ()
 Resets the cancellation status.

Public Attributes

H_Int vpos

Protected Member Functions

void progressStatus (const QString &msg)
 Emits a status message to be shown in the UI status bar.
void runOnGuiThread (std::function< void()> fn)
 Runs fn on the application's main/GUI thread, regardless of the calling thread.
void uiProminenceDistributionSpline (const QVector< QPair< qreal, qreal > > &points, qreal min, qreal max, qreal minF, qreal maxF, const QString &seriesName, const QString &distImageFileName)
void uiProminenceDistributionArea (const QVector< QPair< qreal, qreal > > &points, const qreal min, const qreal max, const qreal minF, const qreal maxF, const QString &name, const QString &distImageFileName)
void uiProminenceDistributionBars (const QStringList &categories, const QVector< qreal > &frequencies, const qreal min, const qreal max, const qreal minF, const qreal maxF, const QString &name, const QString &distImageFileName)

Private Member Functions

GraphsubgraphFromVertexList (const QList< int > &vertexNums, const QString &name, const bool &includeCustomAttributes=true)
 Core helper: builds an independent Graph copy from an explicit list of vertex numbers.
void applyVisibilitySnapshot (const GraphVisibilitySnapshot &snap)
 Restores vertex and edge visibility to the state recorded in snap.
void vertexFilterReplaySpec (const FilterSpec &spec)
 Re-applies one filter from its stored replay parameters.
void edgeAdd (const int &v1, const int &v2, const qreal &weight, const int &type, const QString &label, const QString &color)
 Adds a directed arc from v1 to v2 into the internal graph data structures.
void dijkstra (const int &s, const int &si, const bool &computeCentralities=false, const bool &inverseWeights=false, const bool &dropIsolates=false)
void minmax (qreal C, GraphVertex *v, qreal &max, qreal &min, int &maxNode, int &minNode)
 Computes minimum and maximum centralities during graphDistancesGeodesic().
void resolveClasses (qreal C, H_StrToInt &discreteClasses, int &classes)
 Checks if score C is a new prominence class If yes, it stores that number in a QHash<QString,int> type where the score is the key. If no, increases the frequency of this prominence score by 1 Called from graphDistancesGeodesic().
void resolveClasses (qreal C, H_StrToInt &discreteClasses, int &classes, int name)
 Overloaded method. It only adds displaying current vertex for debugging purposes.
void layoutRandomInMemory ()
 Repositions all vertices at random coordinates without emitting any signals.

Private Attributes

QThread file_parserThread
QThread webcrawlerThread
VList m_graph
Parserfile_parser
WebCrawlerweb_crawler
QQueue< QUrl > * urlQueue
int m_crawler_max_urls
int m_crawler_visited_urls
QList< QString > m_relationsList
QList< bool > m_relationsDirected
QList< int > m_graphFileFormatExportSupported
QList< int > triadTypeFreqs
QList< int > m_verticesList
QList< int > m_verticesIsolatedList
QList< int > m_verticesSelected
QSet< int > m_verticesSet
QList< SelectedEdgem_selectedEdges
QStack< GraphVisibilitySnapshotm_visibilityHistory
QMultiHash< int, int > m_vertexPairsNotConnected
QHash< int, int > m_vertexPairsUnilaterallyConnected
QMultiMap< int, L_intm_cliques
QHash< int, QSet< int > > neighboursHash
QList< qreal > m_clusteringLevel
QMap< int, V_intm_clustersPerSequence
QMap< QString, V_intm_clustersByName
QMap< int, V_strm_clusterPairNamesPerSeq
Matrix SIGMA
Matrix DM
Matrix invAM
Matrix AM
Matrix invM
Matrix WM
Matrix XM
Matrix XSM
Matrix XRM
Matrix CLQM
QHash< int, Matrixm_apspDist
QHash< int, Matrixm_apspSigma
H_StrToInt discreteDPs
H_StrToInt discreteSDCs
H_StrToInt discreteCCs
H_StrToInt discreteBCs
H_StrToInt discreteSCs
H_StrToInt discreteIRCCs
H_StrToInt discreteECs
H_StrToInt discreteEccentricities
H_StrToInt discretePCs
H_StrToInt discreteICs
H_StrToInt discretePRPs
H_StrToInt discretePPs
H_StrToInt discreteEVCs
H_StrToInt discreteCLCs
H_StrToInt discreteKCs
H_StrToInt discreteBPCs
QString m_reportsDataDir
int m_reportsRealPrecision
int m_reportsLabelLength
ChartType m_reportsChartType
ReportFormat m_reportsOutputFormat
int m_fieldWidth
int m_curRelation
int m_fileFormat
int m_vertexClicked
MyEdge m_clickedEdge
qreal edgeWeightTemp
qreal edgeReverseWeightTemp
qreal meanSDC
qreal varianceSDC
qreal meanSCC
qreal varianceSCC
qreal meanIRCC
qreal varianceIRCC
qreal meanSBC
qreal varianceSBC
qreal meanSSC
qreal varianceSSC
qreal meanEC
qreal varianceEC
qreal meanSPC
qreal varianceSPC
qreal meanIC
qreal varianceIC
qreal meanEVC
qreal varianceEVC
qreal meanKC
qreal varianceKC
qreal meanBPC
qreal varianceBPC
qreal meanSDP
qreal varianceSDP
qreal meanPP
qreal variancePP
qreal meanPRP
qreal variancePRP
qreal minEccentricity
qreal maxEccentricity
qreal minSDP
qreal maxSDP
qreal sumDP
qreal sumSDP
qreal groupDP
qreal minSDC
qreal maxSDC
qreal sumDC
qreal sumSDC
qreal groupDC
qreal minSCC
qreal maxSCC
qreal nomSCC
qreal denomSCC
qreal sumCC
qreal sumSCC
qreal groupCC
qreal maxIndexCC
qreal minIRCC
qreal maxIRCC
qreal nomIRCC
qreal denomIRCC
qreal sumIRCC
qreal groupIRCC
qreal minSBC
qreal maxSBC
qreal nomSBC
qreal denomSBC
qreal sumBC
qreal sumSBC
qreal groupSBC
qreal maxIndexBC
qreal minSPC
qreal maxSPC
qreal nomSPC
qreal denomSPC
qreal t_sumIC
qreal sumSPC
qreal groupSPC
qreal maxIndexPC
qreal minSSC
qreal maxSSC
qreal sumSC
qreal sumSSC
qreal groupSC
qreal maxIndexSC
qreal minEC
qreal maxEC
qreal nomEC
qreal denomEC
qreal sumEC
qreal groupEC
qreal maxIndexEC
qreal minIC
qreal maxIC
qreal nomIC
qreal denomIC
qreal sumIC
qreal maxIndexIC
qreal minEVC
qreal maxEVC
qreal nomEVC
qreal denomEVC
qreal sumEVC
qreal sumSEVC
qreal groupEVC
qreal minKC
qreal maxKC
qreal sumKC
qreal m_lastKatzAlpha = -1
qreal minBPC
qreal maxBPC
qreal sumBPC
qreal m_lastBonacichAlpha = -1
qreal m_lastBonacichBeta = 0
qreal minPRP
qreal maxPRP
qreal nomPRC
qreal denomPRC
qreal sumPC
qreal t_sumPRP
qreal sumPRP
qreal minPP
qreal maxPP
qreal nomPP
qreal denomPP
qreal sumPP
qreal groupPP
qreal minCLC
qreal maxCLC
qreal averageCLC
qreal varianceCLC
qreal d_factor
int maxNodeCLC
int minNodeCLC
int classesSDP
int maxNodeDP
int minNodeDP
int classesSDC
int maxNodeSDC
int minNodeSDC
int classesSCC
int maxNodeSCC
int minNodeSCC
int classesIRCC
int maxNodeIRCC
int minNodeIRCC
int classesSBC
int maxNodeSBC
int minNodeSBC
int classesSPC
int maxNodeSPC
int minNodeSPC
int classesSSC
int maxNodeSSC
int minNodeSSC
int classesEC
int maxNodeEC
int minNodeEC
int classesEccentricity
int maxNodeEccentricity
int minNodeEccentricity
int classesIC
int maxNodeIC
int minNodeIC
int classesPRP
int maxNodePRP
int minNodePRP
int classesPP
int maxNodePP
int minNodePP
int classesCLC
int classesEVC
int maxNodeEVC
int minNodeEVC
int classesKC
int maxNodeKC
int minNodeKC
int classesBPC
int maxNodeBPC
int minNodeBPC
int m_graphModStatus
int m_reserveEdgesPerVertexSize
int m_totalVertices
int m_totalEdges
int m_graphDiameter
int initVertexSize
int initVertexLabelSize
int initVertexNumberSize
int initVertexNumberDistance
int initVertexLabelDistance
bool order
bool initEdgeWeightNumbers
bool initEdgeLabels
qreal m_graphAverageDistance
qreal m_graphGeodesicsCount
qreal m_graphDensity
qreal m_graphSumDistance
qreal m_graphReciprocityArc
qreal m_graphReciprocityDyad
int m_graphReciprocityTiesReciprocated
int m_graphReciprocityTiesNonSymmetric
int m_graphReciprocityTiesTotal
int m_graphReciprocityPairsReciprocated
int m_graphReciprocityPairsTotal
bool m_graphHasVertexCustomIcons
int outboundEdgesVert
int inboundEdgesVert
int reciprocalEdgesVert
qreal canvasWidth
qreal canvasHeight
bool calculatedEdges
bool calculatedVertices
bool calculatedVerticesList
bool calculatedVerticesSet
bool m_verticesCacheDropIsolates = false
bool m_verticesCacheCountAll = false
bool calculatedAdjacencyMatrix
bool calculatedDistances
bool calculatedCentralities
bool calculatedIsolates
bool calculatedEVC
bool calculatedKC
bool calculatedBPC
bool calculatedDP
bool calculatedDC
bool calculatedPP
bool calculatedIRCC
bool calculatedIC
bool calculatedPRP
bool calculatedTriad
bool calculatedGraphSymmetry
bool calculatedGraphReciprocity
bool calculatedGraphDensity
bool calculatedGraphWeighted
std::atomic< bool > m_progressCanceled
bool m_graphIsDirected
bool m_graphIsSymmetric
bool m_graphIsWeighted
bool m_graphIsConnected
int m_graphWeaklyConnectedComponents
int m_graphStronglyConnectedComponents
QHash< int, int > m_vertexComponentId
int csRecDepth
QString m_fileName
QString m_graphName
QString initEdgeColor
QString initEdgeColorZero
QString initVertexColor
QString initVertexNumberColor
QString initVertexLabelColor
bool initShowZeroWeightEdges
QString initVertexShape
QString initVertexIconPath
QString htmlHead
QString htmlHeadLight
QString htmlEnd
QDateTime actualDateTime

Friends

class DistanceEngine

Detailed Description

The Graph class This is the main class for a Graph, used in conjuction with GraphVertex, Parser and Matrix objects. Graph class methods are the interface to various analysis algorithms GraphVertex class holds each vertex data (colors, strings, statistics, etc) Matrix class holds the adjacency matrix of the network. Parser class loads files of networks.

Member Enumeration Documentation

◆ Clustering

Enumerator
Single_Linkage 
Complete_Linkage 
Average_Linkage 

◆ ModStatus

Enumerator
NewNet 
SavedUnchanged 
MinorOptions 
VertexMetadata 
EdgeMetadata 
VertexPositions 
MajorChanges 
VertexCount 
EdgeCount 
VertexEdgeCount 

◆ NodeConnectivityStatus

enum class Graph::NodeConnectivityStatus
strong
Enumerator
Ok 
Adjacent 
Invalid 

Constructor & Destructor Documentation

◆ Graph()

Graph::Graph ( const int & reserveVerticesSize = 5000,
const int & reserveEdgesPerVertexSize = 500 )

Constructs a Graph.

◆ ~Graph()

Graph::~Graph ( )

Destroys the Graph object.

Member Function Documentation

◆ addGeodesicsCount()

void Graph::addGeodesicsCount ( int n)

◆ addGuideCircle

void Graph::addGuideCircle ( const double & ,
const double & ,
const double &  )
signal

◆ addGuideHLine

void Graph::addGuideHLine ( const double & y0)
signal

◆ addRelationSymmetricStrongTies()

void Graph::addRelationSymmetricStrongTies ( const bool & allRelations = false)

Creates a new symmetric relation by keeping only strong-ties (mutual links) in the current relation. In the new relation, two actors are connected only if they are mutually connected in the current relation.

Parameters
allRelations

◆ addToDistanceSum()

void Graph::addToDistanceSum ( qreal delta)

◆ applyVisibilitySnapshot()

void Graph::applyVisibilitySnapshot ( const GraphVisibilitySnapshot & snap)
private

Restores vertex and edge visibility to the state recorded in snap.

Private helper shared by vertexFilterRestoreAll() and vertexFilterRemoveAt(). Does not touch m_visibilityHistory — callers manage the stack.

◆ apspDistance()

qreal Graph::apspDistance ( const int & v1,
const int & v2 )

Returns the already-computed geodesic distance from vertex v1 to vertex v2, for the current relation, without triggering a recompute (unlike graphDistanceGeodesic() above). RAND_MAX if either vertex is unknown or nothing has been computed yet for this relation.

◆ apspShortestPaths()

int Graph::apspShortestPaths ( const int & v1,
const int & v2 )

Returns the already-computed number of shortest paths from vertex v1 to vertex v2, for the current relation, without triggering a recompute. 0 if either vertex is unknown or nothing has been computed yet for this relation.

◆ canvasMaxRadius

double Graph::canvasMaxRadius ( ) const
slot

Gets the max radius of the canvas.

Returns
double

◆ canvasMinDimension

qreal Graph::canvasMinDimension ( ) const
slot

Gets the min dimensions of the canvas.

Returns
qreal

◆ canvasRandomX

double Graph::canvasRandomX ( ) const
slot

Returns a random x-coordinate adjusted to be visible inside the canvas usable area.

Returns
double

◆ canvasRandomY

double Graph::canvasRandomY ( ) const
slot

Returns a random y-coordinate adjusted to be visible inside the canvas usable area.

Returns
double

◆ canvasSizeSet

void Graph::canvasSizeSet ( const int & width,
const int & height )
slot

Sets the size of the canvas.

Called when the MW is resized to update canvasWidth/canvasHeight, and node positions

Parameters
w
h

◆ canvasSizeSetQuiet

void Graph::canvasSizeSetQuiet ( const qreal & width,
const qreal & height )
slot

Sets the canvas size without rescaling node positions.

Used by Graph::subgraphExtract() to propagate the source graph's canvas dimensions to the new Graph object so that IO routines normalize coordinates correctly on export.

Parameters
widthNew canvas width in pixels.
heightNew canvas height in pixels.

◆ canvasVisibleX

double Graph::canvasVisibleX ( const double & x) const
slot

Checks if x is visible inside the canvas usable area and if not returns an adjusted x-coordinate.

Parameters
x
Returns
double

◆ canvasVisibleY

double Graph::canvasVisibleY ( const double & y) const
slot

Checks if y is visible inside the canvas usable area and if not returns an adjusted y-coordinate.

Parameters
y
Returns
double

◆ centralityBonacich()

void Graph::centralityBonacich ( const qreal & alpha,
const qreal & beta,
const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Computes Bonacich Power Centrality of each vertex, with parameters alpha and beta.

Meaning: like Katz Centrality, credit for indirect connections discounted by distance - but with a twist: beta can be negative, in which case being tied to well-connected others can hurt rather than help a node's score (e.g. a buyer connected to powerful sellers has less bargaining power the more powerful those sellers are). alpha is a free overall scale factor that doesn't change the relative ranking, only the numbers' size.

When to use: whenever the sign of "connections to well-connected others" itself matters (bargaining power, exchange networks) rather than always being a good thing - Katz Centrality and Eigenvector Centrality both assume more indirect connections is always better.

Weights: like Katz and Eigenvector Centrality, this is walk-counting, not shortest-path routing - don't invert a strength-type weight (it would make your strongest ties contribute the least); only invert if the weight genuinely represents a cost.

Compare to: Katz Centrality (KC, see centralityKatz()) is the same walk-counting idea with a single always-positive decay parameter; Bonacich generalizes it with a second, possibly negative parameter beta and a free scale factor alpha. Not to be confused with Power Centrality (PC, Gil-Schmidt, see graphDistancesGeodesic()), a same-sounding but unrelated measure.

Math: b = alpha * (I - beta*R)^-1 * R * 1, where R = A^T (the transpose only matters for directed graphs, same convention as Katz). Only beta must satisfy |beta| < 1/lambda_max(A) for the underlying geometric series to converge; alpha is an unconstrained outer scale factor. Unlike every other centrality measure in this app, b(i) can come out negative when beta is negative - that is a genuine property of the measure, not a bug, and SBPC (b divided by max b) is not guaranteed to land in [0,1] in that case.

Parameters
alpha
beta
considerWeights
inverseWeights
dropIsolates

◆ centralityClosenessIR()

void Graph::centralityClosenessIR ( const bool considerWeights = false,
const bool inverseWeights = false,
const bool dropIsolates = false )

Computes an "improved" closeness centrality index, IRCC, which can be used on disconnected graphs. IRCC is an improved node-level centrality closeness index which focuses on the influence range of each node (the set of nodes that are reachable from it) For each node v, this index calculates the fraction of nodes in its influence range and divides it by the average distance of those nodes from v, ignoring nodes that are not reachable from it.

Meaning: how efficiently can an actor reach the part of the network it can reach? Plain closeness centrality breaks down on a disconnected network, since "distance to everyone" is undefined once some actors are unreachable. IRCC sidesteps that by only ever averaging distances to actors that are actually reachable, so it stays meaningful even when the network is split into several disconnected pieces.

When to use: any time the network might not be fully connected - social media crawls, partial datasets, or naturally fragmented networks (e.g. isolated friend clusters) - where plain Closeness Centrality (CC) would otherwise be undefined or require dropping actors.

Weights: shortest-path-based, same as CC - if a weight represents value/strength, invert it so a strong tie behaves like a short/cheap path.

Compare to: Closeness Centrality (CC, see graphDistancesGeodesic()) is the classic version this generalizes - use CC directly once the graph is known to be fully connected. Proximity Prestige (PP, see prestigeProximity()) is prestige's directed-graph counterpart of this same idea (distance from others, rather than to them).

Math: for actor i, let J_i be the set of nodes reachable from i (its influence range). IRCC(i) = [ |J_i| / (N-1) ] / [ (sum of d(i,j) for j in J_i) / |J_i| ] - the fraction of the network i can reach, divided by the average distance to that reachable set.

Parameters
considerWeights
inverseWeights
dropIsolates

◆ centralityDegree()

void Graph::centralityDegree ( const bool & considerWeights = true,
const bool & dropIsolates = false )

Calculates the degree (outDegree) centrality of each vertex - diagonal included.

Meaning: the simplest centrality there is - how many direct connections (ties) does this actor have? More connections means more prominence, full stop; no attention is paid to who those connections are or how the rest of the network is shaped.

When to use: a fast first-pass screen for "who's active/popular" on any graph, directed or not, connected or not - cheap to compute and easy to explain to a non-technical audience. Weak at finding brokers or long-range influence; pair with betweenness or eigenvector centrality when those matter.

Compare to: Degree Prestige (DP, see prestigeDegree()) is this same idea restricted to inbound ties only - meaningful on directed graphs, where "connections this actor made" and "connections this actor received" can differ a lot.

Weights: no inversion choice here (considerWeights only) - when considered, weights are summed directly, so a stronger tie always adds more, regardless of what the weight means.

Math: DC(i) = number of edges incident to i (or the sum of their weights, if weights are considered). Standardized SDC(i) = DC(i) / (N-1), the fraction of all other actors i is directly tied to.

Parameters
considerWeights
dropIsolates

◆ centralityEigenvector()

void Graph::centralityEigenvector ( const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Computes Eigenvector centrality.

Meaning: not just how many connections you have, but how important your connections are - being tied to a few highly-connected people can outscore being tied to many poorly-connected ones. It is a "popularity feeds back on itself" measure: your score depends on your neighbors' scores, which depend on their neighbors' scores, and so on until the whole network settles into one stable ranking.

When to use: ranking actors by prestige/influence rather than raw activity - e.g. finding the truly influential accounts in a social network (as opposed to merely the most active ones), or citation-network-style "important papers cited by other important papers" reasoning. Needs a connected (or largely connected) graph to produce a meaningful ranking.

Weights: not shortest-path routing - the adjacency matrix entry is used directly as "how much this tie contributes." Don't invert a strength-type weight (that would make your strongest ties count least); only invert if the weight genuinely represents a cost.

Compare to: Katz Centrality (see centralityKatz()) and Bonacich Power Centrality (see centralityBonacich()) generalize this same "connections to well-connected others matter" idea by summing actual walks with a distance-based decay factor instead of finding the dominant eigenvector directly, which makes the decay directly tunable by the user rather than fixed by the network's own structure. Power Centrality (PC, Gil-Schmidt, see graphDistancesGeodesic()) is a different, older, similarly-named but unrelated measure computed straight from vertex degrees rather than via eigen-decomposition.

Math: the eigenvector centrality vector x is the dominant eigenvector of the adjacency matrix A, i.e. the vector solving A*x = lambda_max*x for the largest eigenvalue lambda_max. Computed here via power iteration (Matrix::powerIteration()): start from any vector, repeatedly multiply by A and rescale to unit length - it converges to that eigenvector.

Parameters
considerWeights
inverseWeights

◆ centralityInformation()

void Graph::centralityInformation ( const bool considerWeights = false,
const bool inverseWeights = false )

Computes the Information centrality of each vertex - diagonal included Note that there is no known generalization of Stephenson & Zelen's theory for information centrality to directional data.

Meaning: most centrality measures only look at the single shortest path between two actors. Information centrality gives an actor credit for every path connecting it to others, not just the best one - shorter, less roundabout paths count for more - so an actor sitting on many decent alternative routes can score as centrally as one sitting on the single best route.

When to use: when redundancy of connection matters more than the single fastest route - e.g. assessing how robust an actor's information access is to a single link failing, or comparing actors whose "one best path" scores (closeness, betweenness) look similar but whose actual web of alternative routes differs a lot.

Compare to: Closeness Centrality (CC) also scores actors by distance to others, but only via the single shortest path; Betweenness (BC) counts how often an actor sits on shortest paths between others. Information Centrality is the only one of the three that uses every connecting path, not just the shortest one.

Weights: unlike CC/BC/SC/EC/PC/IRCC, this is not shortest-path routing - the raw weight feeds directly into the B matrix (B_ij = 1 - w_ij), where a larger raw weight already pulls two actors closer together. Don't invert a strength-type weight here (that would weaken your strongest ties); only invert if the weight genuinely represents a cost.

Math: build matrix B where B_ii = 1 + (sum of i's edge weights) and B_ij = 1 - w_ij for i != j, then invert it to get C = B^-1. Information centrality is IC(i) = 1 / [ C_ii + (tr(C) - 2*R) / n ], where tr(C) is the trace of C and R is the sum of any one row of C (interchangeable by construction of B).

Parameters
considerWeights
inverseWeights

◆ centralityKatz()

void Graph::centralityKatz ( const qreal & alpha,
const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Computes Katz Centrality of each vertex, with attenuation factor alpha.

Meaning: credit for indirect connections, discounted the further away they are. Unlike degree centrality, which only counts direct ties, Katz centrality also counts friends-of-friends, friends-of-friends-of-friends, and so on - but each extra hop counts for less, shrunk by alpha (a direct tie counts full price, a 2-hop tie counts alpha times as much, a 3-hop tie counts alpha^2 times as much).

When to use: ranking actors by total reach through the network, with a user-tunable "how much does distance matter" knob - useful when the natural decay eigenvector centrality settles on isn't the one you want, or the graph is disconnected/sparse enough that eigenvector centrality's power iteration doesn't produce a useful ranking.

Weights: like Eigenvector Centrality, this is walk-counting, not shortest-path routing - the adjacency matrix entry is used directly as tie strength. Don't invert a strength-type weight (that would make your strongest ties contribute the least to every walk); only invert if the weight genuinely represents a cost.

Compare to: Eigenvector Centrality (EVC, see centralityEigenvector()) generalizes the same "connections to well-connected others matter" idea via eigen-decomposition instead of an explicit decay parameter. Bonacich Power Centrality (see centralityBonacich()) extends this same formula with a second parameter beta that can be negative, flipping whether being connected to well-connected others helps or hurts. Not to be confused with Power Centrality (PC, Gil-Schmidt, see graphDistancesGeodesic()), a same-sounding but unrelated measure.

Math: C_Katz(i) = sum_{k=1}^inf sum_j alpha^k (A^k)_ji, i.e. the discounted count of walks of every length arriving at i, since (A^k)_ij is the number of length-k walks between i and j. Computed in closed form via the matrix identity I + xA + x^2*A^2 + x^3*A^3 + ... = (I - xA)^-1 (valid for |x| < 1/lambda_max, the same geometric-series identity used for ordinary numbers, applied to matrices): C_Katz = ((I - alpha*A^T)^-1 - I) * 1 (the transpose only matters for directed graphs; for undirected graphs A = A^T). alpha must satisfy |alpha| < 1/lambda_max(A), where lambda_max is the adjacency matrix's dominant eigenvalue (see estimateSpectralRadius()), or the underlying geometric series does not converge and the inversion is singular/meaningless.

Parameters
alpha
considerWeights
inverseWeights
dropIsolates

◆ clear()

void Graph::clear ( const QString & reason = "")

Clears all vertices.

Parameters
reason

◆ clusteringCoefficient()

qreal Graph::clusteringCoefficient ( )

Computes local clustering coefficients and returns the network average Clustering Coefficient.

Parameters
updateProgress
Returns

◆ clusteringCoefficientLocal()

qreal Graph::clusteringCoefficientLocal ( const int & v1)

Returns the local clustering coefficient (CLUCOF) of vertex v1.

Meaning: not a measure of how prominent an actor is, but of how tightly-knit its neighborhood is - do this actor's friends also know each other, or is the actor the only thing connecting a set of strangers? A score near 1 means the neighborhood is a tight clique; near 0 means the actor bridges otherwise-unconnected people.

When to use: studying local cohesion and "small world" structure - identifying tightly-knit cliques, triadic closure, or (as the actor-level building block of the graph-wide average) assessing how clustered a network is overall. Not a prominence/ranking measure like the centrality and prestige indices above - a high-CLC actor isn't necessarily important, just embedded in a dense neighborhood.

For undirected (symmetric) graphs, uses the Watts–Strogatz formula:

C_i = 2 * |{e_jk : v_j, v_k ∈ N_i, e_jk ∈ E}| / ( k_i * (k_i - 1) )

where N_i is the set of direct neighbours of v_i and k_i = |N_i|. Because the graph is symmetric every undirected edge is counted once (the reverse-edge dedup guard in the inner loop is preserved).

For directed (asymmetric) graphs, uses the generalisation described in the SocNetV manual (equivalent to Watts–Strogatz extended to digraphs):

C_i = |{e_jk : v_j, v_k ∈ N_i, e_jk ∈ E}| / ( k_i * (k_i - 1) )

where N_i is the UNION of in-neighbours and out-neighbours of v_i (excluding v_i itself), and each directed edge e_jk is counted independently – i.e. e_jk and e_kj are distinct.

Bug fix (issue #58): the previous implementation built N_i from reciprocalEdgesHash() (only mutual ties), which gave C_i = 0 for nodes whose in- and out-neighbourhood were not identical. N_i must be the full combined neighbourhood for directed networks.

Parameters
v1The vertex number whose local CLUCOF is requested.
Returns
The local clustering coefficient in [0, 1], or 0 for isolates and vertices with fewer than 2 neighbours.

◆ compute_angles()

void Graph::compute_angles ( const QPointF & DV,
const qreal & dist,
qreal & angle1,
qreal & angle2,
qreal & degrees1,
qreal & degrees2 )

Graph::compute_angles Computes the two angles of the orthogonal triangle shaped by two points of difference vector DV and distance dist A = 90 B = angle1 C = angle2.

Parameters
DV
dist
angle1
angle2
degrees1
degrees2

◆ computeOptimalDistance()

qreal Graph::computeOptimalDistance ( const int & V)

Computes the optimal inter-vertex distance for force-directed layouts.

The optimal distance (also called k or naturalLength) represents the radius of the empty area ideally surrounding each vertex. It is derived from the available canvas area per vertex, plus the vertex's own diameter.

Formula: vertexArea = ceil( sqrt( canvasArea / V ) ) — side of a square tile per vertex optimalDistance = vertexDiameter + vertexArea

This gives the distance at which repulsive and attractive forces balance for a uniformly distributed graph. For denser graphs or larger N, vertexArea shrinks (fewer pixels per node), so the returned value decreases — callers may apply their own scaling multiplier on top (e.g. FR uses C=0.9).

Parameters
VNumber of active vertices in the graph.
Returns
Optimal inter-vertex spacing in canvas pixels.

◆ createMatrixAdjacency()

void Graph::createMatrixAdjacency ( const bool dropIsolates = false,
const bool considerWeights = true,
const bool inverseWeights = false,
const bool symmetrize = false )

Creates an adjacency matrix AM where AM(i,j)=1 if i is connected to j and AM(i,j)=0 if i not connected to j.

Parameters
dropIsolates
considerWeights
inverseWeights
symmetrize

◆ createMatrixAdjacencyInverse()

bool Graph::createMatrixAdjacencyInverse ( const QString & method = "lu")

Computes the inverse of the current adjacency matrix.

Parameters
method
Returns

◆ createMatrixDissimilarities()

void Graph::createMatrixDissimilarities ( Matrix & INPUT_MATRIX,
Matrix & DSM,
const int & metric,
const QString & varLocation,
const bool & diagonal,
const bool & considerWeights )

Calls Matrix:distancesMatrix to compute the dissimilarities matrix DSM of the variables (rows, columns, both) in given input matrix using the user defined metric.

Parameters
INPUT_MATRIX
DSM
metric
varLocation
diagonal
considerWeights

◆ createMatrixReachability()

void Graph::createMatrixReachability ( )

Creates the reachability matrix XRM.

◆ createMatrixSimilarityMatching()

void Graph::createMatrixSimilarityMatching ( Matrix & AM,
Matrix & SCM,
const int & measure = METRIC_SIMPLE_MATCHING,
const QString & varLocation = "Rows",
const bool & diagonal = false,
const bool & considerWeights = true )

Calls Matrix:similarityMatrix to compute the similarity matrix SCM of the variables (rows, columns, both) in given input matrix using the selected matching measure.

Parameters
AM
SCM
rows

◆ createMatrixSimilarityPearson()

void Graph::createMatrixSimilarityPearson ( Matrix & AM,
Matrix & PCC,
const QString & varLocation = "Rows",
const bool & diagonal = false )

The Pearson product-moment correlation coefficient (PPMCC, PCC or Pearson's r) is a measure of the linear dependence between two variables X and Y.

As a normalized version of the covariance, the PPMCC is computed with the formula: r =\frac{\sum ^n _{i=1}(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum ^n _{i=1}(x_i - \bar{x})^2} \sqrt{\sum ^n _{i=1}(y_i - \bar{y})^2}}

It gives a value between +1 and −1 inclusive, where 1 is total positive linear correlation, 0 is no linear correlation, and −1 is total negative linear correlation.

In SNA, Pearson correlations can be used to track the similarity between actors, in terms of structural equivalence.

This method creates an actor by actor NxN matrix PCC where the (i,j) element is the Pearson correlation coefficient of actor i and actor j. If the input matrix is the adjacency matrix, the PCC of two nodes measures how related (similar, inverse or not related at all) their patterns of ties tend to be. A positive value means there is strong linear association of the two actors, while a negative value means the inverse. For instance a value of -1 means the two actors have exactly opposite ties to other actors, while a value of 1 means the actors have identical patterns of ties to other actors (they are connected to the same actors).

The correlation measure of similarity is particularly useful when the data on ties are valued

Parameters
AM
PCC
rows

◆ dijkstra()

void Graph::dijkstra ( const int & s,
const int & si,
const bool & computeCentralities = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )
private

methods used by graphDistancesGeodesic()

◆ edgeAdd()

void Graph::edgeAdd ( const int & v1,
const int & v2,
const qreal & weight,
const int & type,
const QString & label,
const QString & color )
private

Adds a directed arc from v1 to v2 into the internal graph data structures.

This is the low-level storage function. It does NOT signal the UI. All UI signaling is handled by the caller (edgeCreate / signalDrawEdge).

Internally, each vertex maintains two adjacency lists:

  • OutEdges: arcs going OUT from this vertex
  • InEdges: arcs coming IN to this vertex

For a directed arc v1->v2:

  • v1's OutEdges gains v2 (with weight, color, label)
  • v2's InEdges gains v1 (with weight)

For an undirected edge (EdgeType::Undirected), the edge is stored as two symmetric directed arcs:

  • v1->v2 (OutEdge of v1, InEdge of v2)
  • v2->v1 (OutEdge of v2, InEdge of v1) This matches SocNetV's internal convention: undirected edges are always represented as a pair of reciprocal directed arcs in the adjacency structure.

For EdgeType::Reciprocated, the reverse arc v2->v1 already exists in the data model (created earlier as a directed arc). No additional storage is needed here; the caller is responsible for updating type semantics if required.

Weight handling: If weight != 1 and weight != 0, the graph is marked as weighted. Weight == 0 is treated as a visual-only "null" edge drawn in initEdgeColorZero (#30).

Parameters
v1Source node number (external node number, not internal index)
v2Target node number (external node number, not internal index)
weightEdge weight
typeEdgeType::Directed, Undirected, or Reciprocated
labelEdge label (optional, stored on the out-arc of v1)
colorEdge color (optional, stored on the out-arc of v1)

◆ edgeAttributesImport()

int Graph::edgeAttributesImport ( const QStringList & headers,
const QVector< QStringList > & rows,
int srcColumn,
int tgtColumn )

Imports custom attributes from a parsed table into existing edges.

Each row is matched to an edge by looking up vertex numbers from srcColumn and tgtColumn. All other columns become custom attributes on the matched edge. Rows that do not match any existing edge are skipped.

Example — CSV input with srcColumn=0, tgtColumn=1. Native editable columns (Weight, Label, Color) are routed to their setters; read-only native columns (Relation) are silently skipped:

Source,Target,Weight,Label,Color,relationship,strength
1,2,0.8,,#666666,invested_in,strong ← Weight/Color updated; relationship/strength → custom attrs
2,3,0.5,,#666666,mentors,medium
Returns
Number of edges that received at least one attribute update.

◆ edgeClicked()

MyEdge Graph::edgeClicked ( )

Returns clicked edge.

Returns

◆ edgeClickedSet

void Graph::edgeClickedSet ( const int & v1,
const int & v2,
const bool & openMenu = false )
slot

Sets the clicked edge.

Parameters are the source and target node of the edge. It emits signal to MW, which displays a relevant message on the status bar.

Parameters
v1
v2

◆ edgeColor()

QString Graph::edgeColor ( const int & v1,
const int & v2 )

Returns the color of the directed edge v1->v2.

Parameters
v1
v2
Returns

◆ edgeColorAllSet()

bool Graph::edgeColorAllSet ( const QString & color,
const int & threshold = RAND_MAX )

Changes the color of all enabled edges.

Parameters
color
Returns

◆ edgeColorInit()

void Graph::edgeColorInit ( const QString & color)

Saves the default edge color Used by random network creation methods.

Parameters
color

◆ edgeColorSet()

void Graph::edgeColorSet ( const int & v1,
const int & v2,
const QString & color )

Changes the color of edge v1->v2.

Parameters
v1
v2
color

◆ edgeColorZeroInit()

void Graph::edgeColorZeroInit ( const QString & color)

◆ edgeCreate

bool Graph::edgeCreate ( const int & v1,
const int & v2,
const qreal & weight,
const QString & color,
const int & type = 0,
const bool & drawArrows = true,
const bool & bezier = false,
const QString & label = QString(),
const bool & signalMW = true,
const QHash< QString, QString > & edgeCustomAttributes = QHash<QString,QString>() )
slot

Checks if edge (v1,v2) already exists, then creates it and signals the UI to draw it.

Slots to signals from GraphicsWidget and Parser

This is the main entry point for edge creation, called from:

  • Parser::signalCreateEdge (when loading a network file)
  • MainWindow (when user clicks "add link" button)
  • GraphicsWidget (when user middle-clicks two nodes)

Edge type semantics:

  • EdgeType::Undirected : stores both v1->v2 and v2->v1 internally (via edgeAdd), draws a single undirected edge in the UI.
  • EdgeType::Directed : stores only v1->v2. If v2->v1 already exists, upgrades both to EdgeType::Reciprocated.
  • EdgeType::Reciprocated: both directions exist with equal weight.

Mixed-section Pajek files (*Arcs followed by *Edges): Some Pajek files declare directed arcs in an *Arcs section AND undirected edges in a subsequent *Edges section. The same node pair (v1,v2) may appear in both. When *Arcs are processed first, v1->v2 is stored as a directed arc. When *Edges is processed later, edgeExists(v1,v2) returns non-zero, so we must NOT silently drop the request. If v2->v1 is still missing, we store the reverse arc and upgrade the existing forward arc visual to Reciprocated.

In that special case:

  • We store the reverse arc v2->v1 using the undirected edge's weight/color/label. The forward arc (from *Arcs) is left untouched to preserve its original data.
  • We emit signalDrawEdge(v2, v1, ..., Reciprocated) — note the swapped arguments. GraphicsWidget::drawEdge() with Reciprocated looks up the existing arc via edgeKey(targetNum, sourceNum). Since edgeKey() is order-sensitive (packs relation/v1/v2 in that order), passing (v2,v1) makes targetNum=v1, sourceNum=v2, so the lookup resolves to edgeKey(v1,v2) which matches the key stored during *Arcs processing. No new GraphicsEdge is created; setDirectionType() is called instead.
  • drawArrows is forced true: a reciprocated edge always shows arrows on both ends regardless of what the undirected request's drawArrows value was.
  • We do NOT set m_graphIsDirected: adding the missing reverse makes the pair more symmetric, not less. Directedness is determined by the overall graph state after full import completes.
  • We return true because a new arc was genuinely added to the graph.
Parameters
v1Source node number
v2Target node number
weightEdge weight
colorEdge color
typeEdge type: EdgeType::Undirected, Directed, or Reciprocated
drawArrowsWhether to draw arrowheads in the UI
bezierWhether to draw the edge as a bezier curve
labelEdge label (optional)
signalMWWhether to signal MainWindow after modifying graph state
Returns
true if a new edge (or reverse arc) was created, false if fully skipped

◆ edgeCreateWebCrawler

void Graph::edgeCreateWebCrawler ( const int & source,
const int & target )
slot

Called from WebCrawler when it finds an new link Calls edgeCreate() method with initEdgeColor.

Parameters
source
target

◆ edgeCustomAttributes()

QHash< QString, QString > Graph::edgeCustomAttributes ( const int & v1,
const int & v2 ) const

Returns the custom attributes stored on edge v1→v2. Returns an empty hash if no attributes have been set for that edge.

Parameters
v1Source vertex number.
v2Target vertex number.

◆ edgeCustomAttributesSet()

void Graph::edgeCustomAttributesSet ( const int & v1,
const int & v2,
const QHash< QString, QString > & attrs )

Sets all custom attributes on edge v1→v2, replacing any previously stored attributes for that edge.

Parameters
v1Source vertex number.
v2Target vertex number.
attrsKey/value map of custom attributes.

◆ edgeExists()

qreal Graph::edgeExists ( const int & v1,
const int & v2,
const bool & checkReciprocal = false )

Checks if there is an edge from v1 to v2 and returns the weight, if the edge exists.

Complexity: O(logN) for vpos retrieval + O(1) for QList index retrieval + O(logN) for checking edge(v2)

Parameters
v1
v2
reciprocatedif true, checks if the edge is reciprocated (v1<->v2) with the same weight
Returns
zero if edge or reciprocated edge does not exist or non-zero if arc /reciprocated edge exists

◆ edgeExistsVirtual()

qreal Graph::edgeExistsVirtual ( const int & v1,
const int & v2 )

Checks if there is an edge from v1 to v2, even weight = 0 and returns the weight, if the edge exists or RAND_MAX if the edge does not exist at all.

This is only used in GraphML saving if the user has selected the Settings option to save zero-weight edges

See also
https://github.com/socnetv/app/issues/151
Parameters
v1
v2

◆ edgeFilterByAttribute

void Graph::edgeFilterByAttribute ( const FilterCondition & cond)
slot

Hides all edges whose custom attribute does not satisfy cond.

Non-destructive: pushes a GraphVisibilitySnapshot onto m_visibilityHistory before making any changes. Undo via vertexFilterRemoveAt() or vertexFilterRestoreAll().

Returns early with a status message if no edge satisfies the condition.

Parameters
condThe filter condition (key, operator, value).

◆ edgeFilterByQuery

void Graph::edgeFilterByQuery ( const GraphQuery & query)
slot

Shows only edges whose custom attributes satisfy ALL conditions in query.

AND logic: an edge must pass every condition to remain visible. Non-destructive: pushes a GraphVisibilitySnapshot with FilterSpec::Type::EdgeQuery. Undo via vertexFilterRemoveAt() or vertexFilterRestoreAll().

Parameters
queryCompound query; all conditions should have Scope::Edges.

◆ edgeFilterByWeight

void Graph::edgeFilterByWeight ( const qreal m_threshold,
const bool overThreshold )
slot

Hides edges whose weight does not satisfy the threshold condition.

Non-destructive: pushes a GraphVisibilitySnapshot onto m_visibilityHistory before making any changes, so the filter can be undone via vertexFilterRemoveAt().

Parameters
m_thresholdThe weight threshold.
overThresholdIf true, keep edges with weight >= threshold (hide the rest); if false, keep edges with weight <= threshold.

◆ edgeFilterReset

void Graph::edgeFilterReset ( )
slot

Re-enables all edges in the current relation.

Restores full edge visibility after a weight filter has been applied. Non-destructive: only visibility is changed, no data is modified.

◆ edgeFilterUnilateral

void Graph::edgeFilterUnilateral ( const bool & toggle)
slot

Enables or disables unilateral edges in current relationship.

If toggle=true, all non-reciprocal edges are disabled, effectively making the network symmetric.

Parameters
toggle

◆ edgeInboundStatusSet()

void Graph::edgeInboundStatusSet ( const int & target,
const int & source,
const bool & toggle = false )

Toggles the status of inbound edge target <- source at target vertex.

Parameters
v1
v2
toggle
Returns

◆ edgeLabel()

QString Graph::edgeLabel ( const int & v1,
const int & v2 ) const

Returns the label of edge v1->v2.

Parameters
v1
v2
Returns

◆ edgeLabelSet()

void Graph::edgeLabelSet ( const int & v1,
const int & v2,
const QString & label )

Changes the label of edge v1->v2.

Parameters
v1
v2
weight

◆ edgeLabelsVisibilitySet()

void Graph::edgeLabelsVisibilitySet ( const bool & toggle)

Toggles the visibility of edge labels.

Parameters
toggle

◆ edgeOutboundStatusSet()

void Graph::edgeOutboundStatusSet ( const int & source,
const int & target,
const bool & toggle = false )

Toggles the status of outbound edge source -> target at source vertex.

Parameters
v1
v2
toggle
Returns

◆ edgeRemove()

void Graph::edgeRemove ( const int & v1,
const int & v2,
const bool & removeReverse = false )

Removes the directed arc v1->v2 or, if the graph is undirected, the edge v1 <->v2.

Emits signal to GW to delete the graphics item.

Parameters
v1
v2
removeReverseif true also removes the reverse edge

◆ edgeRemoveSelected()

void Graph::edgeRemoveSelected ( SelectedEdge & selectedEdge,
const bool & removeReverse )

Removes a SelectedEdge.

Parameters
selectedEdge
removeReverse

◆ edgeRemoveSelectedAll()

void Graph::edgeRemoveSelectedAll ( )

Removes all selected edges.

◆ edgesEnabled()

int Graph::edgesEnabled ( )

Returns the number of enabled ties in the current relation.

IMPORTANT: Naming vs semantics

  • Internally, SocNetV stores adjacency as directed arcs in each vertex's out-edges.
  • For an UNDIRECTED graph, each undirected edge is represented as TWO symmetric arcs (v1->v2 and v2->v1). Therefore, summing outEdgesCount() over all vertices yields 2*E, and we must divide by 2 to return the logical undirected edge count E.
  • For a DIRECTED graph, summing outEdgesCount() over all vertices yields A (the arc count), and we return it as-is.

Caching:

  • m_totalEdges caches the internal count (sum of enabled out-arcs).
  • edgesEnabled() returns the logical count:
    • E for undirected graphs
    • A for directed graphs

TODO / THINK: Self-loops (v->v)

  • A self-loop contributes exactly 1 outbound arc in outEdgesCount().
  • In an UNDIRECTED graph, dividing m_totalEdges by 2 assumes every tie is a symmetric pair. A loop is NOT a symmetric pair, so it would be mishandled by the /2 rule.
  • Decide on a loop policy: (a) forbid loops in undirected graphs (and filter them out here), or (b) count loops separately and adjust the formula to: E = (nonLoopArcs/2) + loopArcs (where loopArcs is the number of enabled v->v arcs).
Returns
int Logical enabled ties: E (undirected) or A (directed)

◆ edgeSymmetric()

bool Graph::edgeSymmetric ( const int & v1,
const int & v2 )

Returns TRUE if edge(v1, v2) is symmetric, i.e. (v1,v2) == (v2,v1).

Parameters
v1
v2
Returns

◆ edgeTypeSet()

void Graph::edgeTypeSet ( const int & v1,
const int & v2,
const qreal & weight,
const int & dirType = EdgeType::Directed )

Changes the direction type of an existing edge.

Parameters
v1
v2
weight

◆ edgeWeight()

qreal Graph::edgeWeight ( const int & v1,
const int & v2 ) const

Returns the weight of the edge v1->v2.

Parameters
v1
v2
Returns
qreal

◆ edgeWeightNumbersVisibilitySet()

void Graph::edgeWeightNumbersVisibilitySet ( const bool & toggle)

Changes the visibility of edge weight numbers.

Parameters
toggle

◆ edgeWeightSet()

void Graph::edgeWeightSet ( const int & v1,
const int & v2,
const qreal & weight,
const bool & undirected = false )

Changes the weight of the edge from vertex v1 to v2 (and optionally of the reverse edge).

Parameters
v1
v2
weight
undirected

◆ estimateSpectralRadius()

qreal Graph::estimateSpectralRadius ( const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Estimates the adjacency matrix's spectral radius (dominant eigenvalue magnitude).

Meaning: how "amplifying" the network's connectivity structure is - the factor by which a signal spreading through the network grows per step, in the worst case. Used to validate the convergence bound for measures built on a geometric series of the adjacency matrix (Katz Centrality, Bonacich Power Centrality): their attenuation parameter must satisfy |x| < 1/lambda_max, or the underlying series - and the matrix inversion computing it in closed form - does not converge.

When to use: before running Katz or Bonacich, to know (or show the user) the actual valid range for alpha/beta on this specific network, rather than a generic guess - dense/large networks can have a lambda_max well into double digits, making the valid range far smaller than it would be for a sparse one.

Compare to: centralityEigenvector() also power-iterates the adjacency matrix to find its dominant eigenvector, and computes this same lambda_max as a side effect - this method exists separately because callers here (Katz, Bonacich, and their dialogs) only need the eigenvalue, not the ranking eigenvector itself.

Math: via power iteration (Matrix::powerIteration()), starting from a unit seed vector - ||Ax|| approximates lambda_max once the iteration converges (Perron-Frobenius: for a non-negative matrix like an adjacency matrix, this is exact for a connected network).

Parameters
considerWeights
inverseWeights
dropIsolates
Returns
the estimated spectral radius, or 0 if the network is empty or the computation was canceled. 0 conventionally means "no bound - any value converges" to callers.

◆ factorial()

int Graph::factorial ( int x)

Calculates and returns x! factorial... used in (n 2)p edges calculation

◆ filterSpecList

QList< FilterSpec > Graph::filterSpecList ( ) const
slot

Returns the FilterSpec list in application order (oldest first).

Available for consumers that need to inspect the active filter sequence (e.g. Phase 1 DialogQueryBuilder prefill). MainWindow currently tracks chip labels separately via m_nodeFilterChips. QStack<T> inherits QVector<T>, so at(0) is the bottom (oldest) entry.

◆ getFileFormat()

int Graph::getFileFormat ( ) const

Returns the format of the last file opened.

Returns
int

◆ getFileName()

QString Graph::getFileName ( ) const

Returns the file name of the current graph, if any.

Returns
QString

◆ getGeodesicsCount()

int Graph::getGeodesicsCount ( )

Returns the number of geodesics (shortest-paths) in the graph.

Returns
int

◆ getName()

QString Graph::getName ( ) const

Returns the name of the current graph.

If graph name is empty, then returns current relation name. If no relation exists, returns "noname"

Returns
QString

◆ getProminenceIndexByName()

int Graph::getProminenceIndexByName ( const QString & prominenceIndexName)

Returns the IndexType of the given prominence index name Called from MW::slotEditNodeFind, MW::slotLayoutRadialByProminenceIndex etc.

Parameters
prominenceIndexName

◆ getSelectedEdges()

QList< SelectedEdge > Graph::getSelectedEdges ( ) const

Returns a QList of user-selected edges in pair<int,int>.

Returns

◆ getSelectedEdgesCount()

int Graph::getSelectedEdgesCount ( ) const

Returns the count of user-selected edges.

Returns

◆ getSelectedVertices()

QList< int > Graph::getSelectedVertices ( ) const

Returns a QList of user-selected vertices.

Returns

◆ getSelectedVerticesCount()

int Graph::getSelectedVerticesCount ( ) const

Returns count of user-selected vertices.

Returns

◆ getSelectedVerticesMax()

int Graph::getSelectedVerticesMax ( ) const

Returns max of user-selected vertices.

Returns

◆ getSelectedVerticesMin()

int Graph::getSelectedVerticesMin ( ) const

Returns min of user-selected vertices.

Returns

◆ getThread()

QThread * Graph::getThread ( ) const

◆ graphClickedEmptySpace

void Graph::graphClickedEmptySpace ( const QPointF & p)
slot

Resets the clicked edge and node.

Usually, called when the user clicks on an empty space.

Parameters
p

◆ graphCliqueAdd()

void Graph::graphCliqueAdd ( const QList< int > & clique)

Called from Graph::graphCliques to add a new clique (list of vertices) Adds clique info to each clique member and updates co-membership matrix CLQM .

Parameters
list
Returns

◆ graphCliques()

void Graph::graphCliques ( QSet< int > R = QSet<int>(),
QSet< int > P = QSet<int>(),
QSet< int > X = QSet<int>() )

Finds all maximal cliques in the graph using the Bron–Kerbosch algorithm with Tomita et al. (2006) pivot selection.

— Algorithm overview —

The Bron–Kerbosch algorithm [1] is a recursive backtracking procedure that maintains three disjoint vertex sets at each call:

R — the clique built so far (all vertices in R are mutually adjacent). P — candidate vertices that can still extend R (each is adjacent to all of R). X — vertices already processed that are also adjacent to all of R (used to avoid reporting the same clique more than once).

When both P and X are empty, R cannot be extended and no super-set of R was reported before — so R is a maximal clique.

— Pivot selection (Tomita et al., 2006) —

Without pivoting the algorithm iterates over every vertex in P at each level, leading to a worst-case exponential blow-up even for graphs with few cliques.

Tomita, Tanaka & Takahashi [2] proved that choosing a pivot vertex u ∈ P∪X that maximises |N(u) ∩ P| (the size of u's neighbourhood intersected with P) allows the main loop to enumerate only the vertices in P \ N(u) — the non-neighbours of u inside the candidate set.

Why this is correct: any maximal clique that extends R must contain at least one vertex from P \ N(u), because if a clique contained only neighbours of u it could be extended by u itself (since u is adjacent to all of them and to all of R), contradicting maximality. So we lose no cliques by restricting the loop to P \ N(u).

Why this is faster: the pivot u was chosen to maximise |N(u) ∩ P|, which minimises |P \ N(u)|. In the best case (a dense graph) |P \ N(u)| ≈ 1, reducing each level of recursion to a single branch. For sparse graphs the improvement is smaller but still significant in practice.

References: [1] Bron, C. & Kerbosch, J. (1973). "Algorithm 457: Finding all cliques of an undirected graph." Commun. ACM, 16(9), 575–577. [2] Tomita, E., Tanaka, A. & Takahashi, H. (2006). "The worst-case time complexity for generating all maximal cliques and computational experiments." Theoretical Computer Science, 363(1), 28–42. https://doi.org/10.1016/j.tcs.2006.06.015

Parameters
RCurrent clique under construction (vertices already chosen).
PCandidate vertices that can extend R.
XExcluded vertices (already processed at this level).

◆ graphCliquesContaining()

int Graph::graphCliquesContaining ( const int & actor,
const int & size = 0 )

Returns the number of maximal cliques which include a given actor

◆ graphCliquesOfSize()

int Graph::graphCliquesOfSize ( const int & size)

Graph::graphCliquesOfSize Returns the number of maximal cliques of a given size.

Parameters
size
Returns

◆ graphClusteringHierarchical()

bool Graph::graphClusteringHierarchical ( Matrix & STR_EQUIV,
const QString & varLocation,
const int & metric,
const int & method,
const bool & diagonal = false,
const bool & diagram = false,
const bool & considerWeights = true,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Performs an hierarchical clustering process (Johnson, 1967) on a given NxN distance/dissimilarity matrix. The input matrix can be the the adjacency matrix, the geodesic distance matrix or a derived from them dissimilarities matrix using a user-specified metric, i.e. euclidean distance. The method parameter defines how to compute distances (similarities) between a new cluster the old clusters. Valid values can be:

◆ graphClusteringMethodStrToType()

int Graph::graphClusteringMethodStrToType ( const QString & method) const

Helper method, return clustering method type from the human readable name of it.

Parameters
method
Returns

◆ graphClusteringMethodTypeToString()

QString Graph::graphClusteringMethodTypeToString ( const int & methodType) const

Helper method, return the human readable name of clustering method type.

Returns

◆ graphConnectednessFull()

int Graph::graphConnectednessFull ( const bool updateProgress = false)

◆ graphConnectivity()

int Graph::graphConnectivity ( bool respectDirection)

Global vertex connectivity kappa(G): the minimum, over every non-adjacent pair of vertices, of their local vertex connectivity (graphNodeConnectivity()) - the network's worst-case robustness to node removal, i.e. the fewest nodes that would need to be removed to disconnect the network at its weakest point.

Naive pairwise-minimum algorithm: iterate all non-adjacent pairs, tracking the minimum local connectivity seen so far, starting that minimum at the cheap degree bound below and pruning with an early exit once it can't go any lower. This is O(n^2) local-connectivity computations in the worst case (O(n) for directed "strong" mode, since kappa(s,t) can differ from kappa(t,s) so ordered pairs must be tested) - deliberately the simple approach rather than the smarter O(n) algorithm (Even 1975, which fixes one vertex and reuses far fewer max-flow computations): SocNetV's networks and this feature's usage pattern (an occasional, user-triggered analysis, not a hot path) don't call for that extra complexity yet, and the two pruning steps below already cut the common cases down a lot in practice.

Two pruning steps, both used here:

  • Fast path: if the graph is already disconnected (per graphWeaklyConnectedComponents() / graphStronglyConnectedComponents(), whichever matches respectDirection), kappa(G) = 0 immediately, with no max-flow computation at all. This is purely an optimization, not a correctness requirement: the pair loop below would reach the same answer on its own the moment it tests the unreachable pair, since local connectivity between an unreachable pair is 0 by construction (max-flow finds no augmenting path) - but checking the already-cached component count first avoids running any flow computation for the common case of an obviously fragmented network.
  • Degree bound (Whitney's inequality): kappa(G) <= delta(G), the minimum vertex degree (its directed analogue: kappa(D) <= min over v of min(indeg(v), outdeg(v))). Seeding the running minimum with this bound and only ever lowering it means a complete graph - where no non-adjacent pair exists at all to test - needs no special case: the pair loop simply never executes, leaving the initial degree bound as the final answer, which is exactly correct (kappa(K_n) = n-1, the minimum degree of K_n).
Parameters
respectDirectiontrue for strong connectivity (ordered pairs, directed reachability); false for weak (unordered pairs, every edge treated as bidirectional). Only meaningful to vary on a directed graph.
Returns
kappa(G).
Note
Precondition: at least 2 enabled vertices. Callers (the GUI's Graph Connectivity action) special-case 0/1-vertex networks the same way Connectedness already does, so this is never invoked otherwise.

◆ graphDensity()

qreal Graph::graphDensity ( )

Gets the graph density (if computed) or computes it again.

The graph density is the ratio of present ties to total possible ties for the current relation.

IMPORTANT: edgesEnabled() semantics in SocNetV:

  • If the graph is UNDIRECTED, edgesEnabled() returns E (undirected edges), even though internally each undirected edge is stored as two symmetric arcs.
  • If the graph is DIRECTED, edgesEnabled() returns A (directed arcs).

Therefore:

  • Undirected density: 2E / (V*(V-1))
  • Directed density: A / (V*(V-1))

TODO / THINK: Self-loops (v->v)

  • The denominator V*(V-1) assumes loops are not allowed/considered.
  • If self-loops can exist and be enabled, decide whether to: (a) exclude loops from the numerator for density, or (b) use a loop-aware denominator (e.g., V*V for directed with loops).
Returns
qreal

◆ graphDiameter()

int Graph::graphDiameter ( const bool considerWeights,
const bool inverseWeights )

Returns the diameter of the graph, aka the largest geodesic distance between any two vertices.

Parameters
considerWeights
inverseWeights
Returns

◆ graphDiameterCached()

int Graph::graphDiameterCached ( ) const

Returns the number of geodesics (shortest paths) in the graph, without recalculating it.

Returns
int

◆ graphDichotomization()

void Graph::graphDichotomization ( const qreal threshold)

Creates a new binary relation in a valued network using edge dichotomization according to the threshold parameter.

Parameters
threshold

◆ graphDistanceEuclidean() [1/2]

qreal Graph::graphDistanceEuclidean ( const QPointF & a)

the euclideian distance of QPointF a (where a is difference vector)

Parameters
a
Returns

◆ graphDistanceEuclidean() [2/2]

qreal Graph::graphDistanceEuclidean ( const QPointF & a,
const QPointF & b )

Computes the euclideian distance between QPointF a and b.

Parameters
a
b
Returns

◆ graphDistanceGeodesic()

int Graph::graphDistanceGeodesic ( const int & v1,
const int & v2,
const bool & considerWeights = false,
const bool & inverseWeights = true )

Returns the geodesic distance (length of shortest path) from vertex v1 to vertex v2.

Parameters
v1
v2
considerWeights
inverseWeights
Returns

◆ graphDistanceGeodesicAverage()

qreal Graph::graphDistanceGeodesicAverage ( const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates )

Returns the average distance of the graph.

Parameters
considerWeights
inverseWeights
dropIsolates
Returns

◆ graphDistanceGeodesicAverageCached()

qreal Graph::graphDistanceGeodesicAverageCached ( ) const

Returns the average geodesic distance of the graph, without recalculating it.

Returns
qreal

◆ graphDistancesGeodesic()

void Graph::graphDistancesGeodesic ( const bool & computeCentralities = false,
const bool & considerWeights = false,
const bool & inverseWeights = true,
const bool & dropIsolates = false )

Computes the geodesic distances between all vertices: In the process, it also computes many other centrality/prestige metrics:

  • The so-called sigma matrix, where the (i,j) element is the number of shortest paths from vertex i to vertex j, called sigma(i,j).
  • The Diameter of the graph, m_graphDiameter, which is the length of the longest shortest path between every (i,j)
  • The Eccentricity of every node i which is the length of the longest shortest path from i to every other node j
  • The InfluenceRange and InfluenceDomain of each node.
  • The centralities for every u in V (if centralities=true):
    • Betweenness: BC(u) = Sum ( sigma(i,j,u)/sigma(i,j) ) for every s,t in V Meaning: how often u sits "in between" on the shortest routes connecting other pairs of actors - a broker/gatekeeper measure. High betweenness means removing u would disrupt many people's shortest path to each other. When to use: finding brokers, bottlenecks, or single points of failure in a communication/supply network - who, if removed, would fragment the network's shortest routes the most. Weights: shortest-path-based - if a weight represents value/strength (interaction frequency, trust), invert it (a strong tie should behave like a short/cheap path) so routing favors the strongest ties, not the weakest. Compare to: Stress (SC) below counts the same "sits on a shortest path" event without dividing by how many alternative shortest paths existed - use BC when you want "share of control" over each pair's routing, SC when you want raw path traffic.
    • Stress: SC(u) = Sum ( sigma(i,j) ) for every s,t in V Meaning: like betweenness, but simply counts how many shortest paths pass through u, without dividing by how many alternative shortest paths existed for that pair - so it also rewards actors on many paths even when those paths weren't a pair's only shortest route. When to use: estimating raw path/traffic load through a node (e.g. network routing, load-bearing infrastructure) rather than its exclusive control over routing. Weights: same shortest-path reasoning as BC above - invert a strength-type weight so strong ties route like short paths.
    • Eccentricity: EC(u) = 1/maxDistance(u,t) for some t in V Meaning: a worst-case reachability measure - how far away is u's single most distant counterpart? High eccentricity centrality means even u's "hardest to reach" other actor is nearby. When to use: worst-case reasoning - e.g. picking a broadcast/facility location that minimizes the longest anyone has to wait to be reached, rather than the average case. Weights: same shortest-path reasoning as BC/SC above - invert a strength-type weight. Compare to: Closeness (CC) below is this same distance-based idea using the average distance instead of the worst case.
    • Closeness: CC(u) = 1 / Sum( d(u,t) ) for every t in V Meaning: how close u is, on average, to everyone else - a low total distance to others gives a high closeness score. Only meaningful on a fully connected graph, since an unreachable actor has undefined distance. When to use: identifying actors who can spread something (information, disease, an influence campaign) to the whole network fastest, on a graph known to be connected. Weights: same shortest-path reasoning as BC/SC/EC above - invert a strength-type weight so a strong tie behaves like a short/cheap path. Compare to: Influence Range Closeness Centrality (IRCC, see centralityClosenessIR()) is this same idea adapted to work on disconnected graphs too.
    • Power (Gil-Schmidt): PC(s) = [1/(N-1)] * Sum_i( nthOrder[i] / i ), where nthOrder[i] is the number of nodes at distance i from s (computed in DistanceEngine::compute()). Meaning: a generalized degree measure that gives (shrinking) credit for nodes several steps away too, not just direct neighbors - similar in spirit to eigenvector centrality, but computed directly from how many nodes sit at each distance rather than via eigen-decomposition. When to use: a cheaper, degree-based alternative to Eigenvector Centrality (EVC) for rewarding both direct and indirect reach, when a full eigen-decomposition isn't needed. Weights: same shortest-path reasoning as BC/SC/EC/CC above (nthOrder is computed from DistanceEngine's shortest-path distances) - invert a strength-type weight. Compare to: Eigenvector Centrality (EVC, see centralityEigenvector()) captures a related "reach plus indirect reach" idea via eigen-decomposition instead. Not to be confused with Bonacich's differently-named, unrelated "Power Centrality" measure (BPC, see centralityBonacich()).
      Parameters
      centralities
      considerWeights
      inverseWeights
      dropIsolates

◆ graphFileLoaded

void Graph::graphFileLoaded ( const int & fileType,
const QString & fileName = QString(),
const QString & netName = QString(),
const int & totalNodes = 0,
const int & totalLinks = 0,
const int & edgeDirType = 0,
const qint64 & elapsedTime = 0,
const QString & message = QString() )
slot

Stores loaded file name, graph name, sets edge direction type and signals MW to update the UI.

Called from Parser when file parsing ends.

Parameters
fileType
fileName
netName
totalNodes
totalLinks
edgeDirType
elapsedTime
message

◆ graphGeodesicDistanceDistribution()

QMap< int, int > Graph::graphGeodesicDistanceDistribution ( const bool & considerWeights = false,
const bool & inverseWeights = false )

Returns a histogram of geodesic distances across all ordered vertex pairs.

Ensures the full APSP result is available (uses cache if graph is unchanged), then iterates all enabled vertex pairs and groups them by their geodesic distance into a QMap<int, int> where key = distance and value = number of ordered pairs at that distance. Unreachable pairs (distance == RAND_MAX) are excluded.

This method is called ONLY on explicit user request — it is never triggered as a side-effect of centrality computation or other internal analysis paths.

Parameters
considerWeightsPass through to graphDistancesGeodesic; selects BFS vs Dijkstra.
inverseWeightsPass through to graphDistancesGeodesic; inverts edge weights.
Returns
QMap<int, int> Sorted map: distance bucket → count of ordered pairs.

◆ graphGeodesicsCountCached()

qreal Graph::graphGeodesicsCountCached ( ) const

Returns the number of geodesics (shortest paths) accumulated by DistanceEngine, without recalculating anything.

◆ graphGeodesicShortestPath()

QList< int > Graph::graphGeodesicShortestPath ( const int & v1,
const int & v2,
const bool & considerWeights = false,
const bool & inverseWeights = false )

Reconstructs one shortest path from vertex v1 to vertex v2.

Runs a single-source BFS (unweighted) or Dijkstra (weighted) from v1, keeping a predecessor array, then traces the path back from v2. This is an on-demand, interactive call — it does NOT touch the APSP cache and is safe to call at any time regardless of calculatedDistances.

Parameters
v1Source vertex number.
v2Target vertex number.
considerWeightsIf true, uses Dijkstra with edge weights; otherwise BFS.
inverseWeightsIf true, uses 1/weight as the edge cost (for closeness-style paths).
Returns
QList<int> Ordered list of vertex numbers on the path, inclusive of v1 and v2. Returns an empty list when v1 == v2 or no path exists.

◆ graphHasEdgeCustomAttributes()

QStringList Graph::graphHasEdgeCustomAttributes ( ) const

Returns a list of all unique custom attribute keys present across all enabled edges in the current graph.

◆ graphHasVertexCustomAttributes()

QStringList Graph::graphHasVertexCustomAttributes ( ) const

Returns true if at least one vertex has a 'custom' attribute.

Returns
bool

◆ graphHasVertexCustomIcons()

bool Graph::graphHasVertexCustomIcons ( ) const

Returns true if at least one vertex has a 'custom' shape (therefore a custom icon).

Returns
bool

◆ graphLoadedTerminateParserThreads

void Graph::graphLoadedTerminateParserThreads ( QString reason)
slot

◆ graphMatrixDistanceGeodesicCreate()

bool Graph::graphMatrixDistanceGeodesicCreate ( const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Creates the matrix DM of geodesic distances between vertices.

Phase 1: calls graphDistancesGeodesic() which runs the DistanceEngine.

Phase 2: fills the DM matrix from the cached per-vertex distances - an O(N²) memory-write pass.

Parameters
considerWeightsIf true, edge weights are used in distance computations.
inverseWeightsIf true, edge weights are inverted before use.
dropIsolatesIf true, isolate nodes are excluded from the analysis.
Returns
true on success, false if the computation was cancelled.

◆ graphMatrixShortestPathsCreate()

void Graph::graphMatrixShortestPathsCreate ( const bool & considerWeights = false,
const bool & inverseWeights = true,
const bool & dropIsolates = false )

Creates the matrix SIGMA of shortest paths (geodesics) between vertices Each SIGMA(i,j) is the number of shortest paths (geodesics) from i and j.

Parameters
considerWeights
inverseWeights
dropIsolates

◆ graphMatrixStrToType()

int Graph::graphMatrixStrToType ( const QString & matrix) const

Helper method, return the matrix type of human readable matrix name .

Parameters
matrix
Returns

◆ graphMatrixTypeToString()

QString Graph::graphMatrixTypeToString ( const int & matrixType) const

Helper method, return the human readable name of matrix type.

Parameters
matrix

◆ graphMetricStrToType()

int Graph::graphMetricStrToType ( const QString & metricStr) const

Helper method, return the identifier of a metric.

Parameters
metricStr

◆ graphMetricTypeToString()

QString Graph::graphMetricTypeToString ( const int & metricType) const

Helper method, return the human readable name of metric type.

Parameters
metric

◆ graphNodeConnectivity()

Graph::NodeConnectivityResult Graph::graphNodeConnectivity ( int source,
int target,
bool respectDirection )

Local vertex connectivity kappa(source, target): the minimum number of nodes, other than source and target themselves, whose removal disconnects target from source.

Computed via Menger's theorem / vertex-split max-flow - see the detailed algorithm comment on localVertexConnectivityFlow() above.

source and target being directly adjacent is reported as NodeConnectivityStatus::Adjacent, not as a number: Menger's theorem requires non-adjacency (an edge is a "path" no vertex removal can ever break), so there is no finite, meaningful cut size to report - reporting some sentinel number here would silently misrepresent "cannot be separated by removing other nodes" as an ordinary connectivity value.

Parameters
source
target
respectDirectiontrue for the "strong" reading (directed reachability, source must reach target via directed paths); false for "weak" (every edge treated as bidirectional). Only meaningful to vary on a directed graph - see the GUI's Connectedness/Node Connectivity prompts, which only ask when isDirected() is true.
Returns
NodeConnectivityResult - see graph.h. Ok.value == 0 is a normal, valid answer (target is simply unreachable from source under the chosen direction mode).

◆ graphReachable()

bool Graph::graphReachable ( const int & v1,
const int & v2 )

Returns true if vertices v1 and v2 are reachable.

Parameters
v1
v2
Returns
bool

◆ graphReciprocity()

qreal Graph::graphReciprocity ( )

Gets the arc reciprocity of the graph.

Also computes the dyad reciprocity and fills parameters with values.

Returns
qreal

◆ graphStronglyConnectedComponents()

int Graph::graphStronglyConnectedComponents ( )

Counts strongly connected components using Tarjan's algorithm.

Strong connectivity respects edge direction: two nodes are in the same Strongly Connected Component (SCC) only if each is reachable from the other via directed edges. This is a strictly finer partition than weak connectivity (graphWeaklyConnectedComponents(), which treats every edge as undirected) - a graph can be a single weak component while having many strong components, e.g. a directed path a->b->c is one weak component but three strong components, since c cannot reach a. For an undirected graph the two notions coincide (every edge is effectively reciprocal), so this still returns the right answer, just via a slightly more roundabout route than graphWeaklyConnectedComponents().

Algorithm (Tarjan 1972): a single Depth First Search (DFS) assigns each vertex a discovery "index" (the order it was first visited) and a "lowlink" - the smallest index reachable from that vertex by following zero or more tree edges and then at most one edge back into an ancestor still on the DFS stack. Vertices are pushed onto an explicit stack as they're discovered and popped once a SCC is found. A vertex is the root of an SCC exactly when its lowlink equals its own index - meaning nothing below it on the DFS stack can reach back above it - and popping the stack down to and including that root yields exactly the members of one SCC. This is O(V+E), a single DFS pass, with no graph transpose needed - unlike Kosaraju's algorithm, which gets the same complexity but needs two passes over a transposed graph. Tarjan's is the better fit here since SocNetV already has cheap out-edge iteration and no existing transpose-graph structure to reuse.

Implemented as an explicit-stack simulation of the textbook recursive DFS, not recursion itself: SocNetV networks can have a directed path of a few thousand nodes (a plausible worst case for a citation or hierarchy network), which would recurse that deep and risk overflowing the real call stack. Each simulated stack frame remembers which out-edge it was in the middle of examining (Frame::cursor), which is exactly the resumption point a real call stack would give for free after a simulated recursive call "returns" (its frame is popped).

m_vertexComponentId (weak-component IDs, used by the colorize-by-component layout action) is NOT touched here; strong components are not currently exposed per-vertex, only as a count.

Returns
Number of strongly connected components.

◆ graphStronglyConnectedComponentsCached()

int Graph::graphStronglyConnectedComponentsCached ( ) const

◆ graphSumDistanceCached()

qreal Graph::graphSumDistanceCached ( ) const

Returns the sum of all finite geodesic distances accumulated by DistanceEngine, without recalculating anything.

◆ graphTriadCensus()

bool Graph::graphTriadCensus ( )

Conducts a triad census and updates QList::triadTypeFreqs, which is the list carrying all triad type frequencies Complexity: O(n³) — three nested loops each bounded by N.

Returns

◆ graphTriadTypeFreqs()

const QList< int > & Graph::graphTriadTypeFreqs ( ) const
inline

◆ graphWalksMatrixCreate()

void Graph::graphWalksMatrixCreate ( const int & N = 0,
const int & length = 0,
const bool & dropIsolates = false,
const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & symmetrize = false )

Computes either the "Walks of given length" or the "Total Walks" matrix. If length>0, it computes the Walks of given length matrix, XM=AM^l where each element (i,j) denotes the number of walks of length l between vertex i and j. If length=0, it computes the Total Walks matrix, XSM=Sum{AM^n} where each (i,j) denotes the total number of walks of any length between vertices i and j. NOTE: In the latter case, this function is VERY SLOW on large networks (n>50), since it will calculate all powers of the sociomatrix up to n-1 in order to find out all possible walks.

Parameters
N- dimension of the sociomatrix (number of vertices). Default is 0, in which case it will be calculated as the number of vertices in the graph.
length- the length of walks to be calculated. Default is 0, in which case all walks of any length will be calculated.

◆ graphWeaklyConnectedComponents()

int Graph::graphWeaklyConnectedComponents ( )

Counts weakly connected components using BFS.

Weak connectivity treats every edge as undirected regardless of graph type:

  • Undirected: equivalent to ordinary connected components.
  • Directed: two nodes are in the same component when there is an undirected path between them (ignoring arrow direction). Answers the practical "how many disconnected islands?" question consistently for both types. Does NOT imply strong connectivity (all-pairs directed reachability); use isConnected() / graphDistancesGeodesic() for that.

m_graphIsConnected is NOT touched here; that flag belongs to the SSSP engine. Component IDs (1-based) are cached in m_vertexComponentId keyed by vertex number, ready for the colorize-by-component layout action.

Returns
Number of weakly connected components.

◆ graphWeaklyConnectedComponentsCached()

int Graph::graphWeaklyConnectedComponentsCached ( ) const

◆ hasCalculatedTriadCensus()

bool Graph::hasCalculatedTriadCensus ( ) const
inline

◆ htmlEscaped

QString Graph::htmlEscaped ( QString str) const
slot

Helper method, returns a nice qstring where all html special chars are encoded.

Parameters
str
Returns

◆ incGeodesicsCount()

void Graph::incGeodesicsCount ( )

◆ isAnyRelationWeighted()

bool Graph::isAnyRelationWeighted ( )

Returns true if any relation in the graph has at least one edge with weight other than 0 or 1.

Unlike isWeighted(), which only scans the current relation, this method iterates every relation. It is used to report overall graph weightedness independently of which relation is currently active.

◆ isCentralityIndexComputed()

bool Graph::isCentralityIndexComputed ( const IndexType index) const

Returns true if the given centrality/prestige index has been computed.

Uses the per-index calculated* flags set by each analysis method. Matches the IndexType enum defined in global.h.

◆ isConnected()

bool Graph::isConnected ( )

Checks if the graph is connected, in the sense of a topological space, i.e., there is a path from any vertex to any other vertex in the graph.

Returns
bool

◆ isConnectedCached()

bool Graph::isConnectedCached ( ) const

Returns true if the graph is connected, without recalculating it.

Returns
bool

◆ isDirected()

bool Graph::isDirected ( )

Returns true if graph is directed.

Returns
bool

◆ isEmpty()

bool Graph::isEmpty ( ) const

Returns true if the current graph has no vertices at all.

◆ isFileFormatExportSupported()

bool Graph::isFileFormatExportSupported ( const int & fileFormat) const

Returns true if the fileFormat is supported for saving.

Parameters
fileFormat
Returns

◆ isLoaded()

bool Graph::isLoaded ( ) const

Returns true if a graph has been loaded from a file.

Returns

◆ isModified()

bool Graph::isModified ( ) const

Returns true of graph is modified (edges/vertices added/removed).

Returns

◆ isSaved()

bool Graph::isSaved ( ) const

Returns true if the graph is saved.

Returns

◆ isSymmetric()

bool Graph::isSymmetric ( )

Returns TRUE if the adjacency matrix of the current relation is symmetric.

Returns
bool

◆ isUndirected()

bool Graph::isUndirected ( )

Returns true if graph is undirected.

Returns
bool

◆ isWeighted()

bool Graph::isWeighted ( )

Returns true if the current relation has at least one edge with weight other than 0 or 1 (i.e. the relation is valued/weighted).

The result is cached via calculatedGraphWeighted and invalidated on every relation switch (

See also
relationSet()). Consequently, for multi-relation graphs this method only reflects the active relation — switching to a non-weighted relation after a weighted one will return false.

When you need to know whether any relation is weighted, use

See also
isAnyRelationWeighted() instead.

Complexity: O(n²) on cache miss, O(1) on hit.

◆ layoutByProminenceIndex()

void Graph::layoutByProminenceIndex ( int prominenceIndex,
int layoutType,
const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Applies a layout according to each actor's prominence index score. The layout type can be radial (0), level (1), node sizes (2) or node colors (3), as follows: layoutType=0 - Repositions all nodes on the periphery of concentric circles with radius analogous to their prominence index layoutType=1 - Repositions all nodes on different top-down levels according to their centrality layoutType=2 - Changes node sizes to be proportional to their prominence index score layoutType=2 - Changes node colors to reflect their prominence index score (from red to green).

Parameters
prominenceIndex,0-12
layoutType0,1,2,3
considerWeights
inverseWeights
dropIsolates

◆ layoutCircular()

void Graph::layoutCircular ( const double & x0,
const double & y0,
const double & newRadius,
const bool & guides = false )

Repositions all nodes on the periphery of a circle with given radius.

Parameters
x0
y0
maxRadius

◆ layoutEgoRadial()

void Graph::layoutEgoRadial ( const int egoVertex)

Ego-centered radial layout.

Places egoVertex at the canvas center, its 1-hop out-neighbors (in the current relation) on an inner ring, and all remaining enabled nodes on an outer ring. Only node positions are changed — graph structure is untouched.

Ring radii are fixed fractions of canvasMaxRadius(): ring1 = 0.35 × maxRadius (ego neighbors) ring2 = 0.75 × maxRadius (all other nodes)

Edge case: if egoVertex does not exist, emits a status message and returns.

Parameters
egoVertexThe vertex number to place at the center.

◆ layoutForceDirected_Eades_moveNodes()

qreal Graph::layoutForceDirected_Eades_moveNodes ( const qreal & c4)

Moves all vertices to their new positions as computed by the Eades Spring Embedder model.

Called once per iteration from layoutForceDirectedSpringEmbedder(). Applies the accumulated displacement vectors to each vertex position, scaled by the normalization factor c4, and clamps the result to the visible canvas area.

Displacement clamping: each component (x, y) is capped at ±(canvasMinDimension * 0.05) before being applied. This prevents the "iteration-2 explosion" caused by near-coincident node pairs at the start of the simulation — without the cap, f_rep = c_rep/dist² diverges for dist→0 and a single node pair can produce a 100px+ spike that locks the layout into a bad configuration for all remaining iterations.

Node positions are updated in-memory only (setX/setY). The caller is responsible for emitting setNodePos signals in a single bulk pass after the iteration loop completes — this avoids N×maxIterations signal emissions to the graphics scene.

Parameters
c4Displacement normalization factor for this iteration. Supplied by the caller's linear cooling schedule (decreases from c4_init to c4_min over maxIterations) to progressively damp movement and allow the layout to settle.
Returns
The largest Euclidean displacement applied to any single vertex this iteration (canvas pixels). Used by the caller for convergence detection.

◆ layoutForceDirected_F_att()

qreal Graph::layoutForceDirected_F_att ( const QString model,
const qreal & dist,
const qreal & optimalDistance )

Computes the attractive (spring) force between two adjacent vertices.

For the Eades model: logarithmic spring force scaled by c_spring = 2. Note: log10(dist / optimalDistance) is negative when dist < optimalDistance, meaning the spring pushes nodes apart when they are closer than the natural length — this is intentional per Eades (1984), who uses a log spring that both attracts far-apart neighbours and repels too-close ones.

For the FR model: quadratic attraction as per Fruchterman & Reingold (1991).

Parameters
modelLayout model identifier: "Eades" or "FR".
distEuclidean distance between the two adjacent vertices (canvas pixels).
optimalDistanceThe natural/optimal inter-vertex spacing for the current graph.
Returns
Attractive force magnitude (positive = pull toward each other).

◆ layoutForceDirected_F_rep()

qreal Graph::layoutForceDirected_F_rep ( const QString model,
const qreal & dist,
const qreal & optimalDistance )

Computes the repulsive force between two vertices for force-directed layouts.

For the Eades model: uses an inverse-square law with constant c_rep.

  • The previous cutoff (f_rep = 0 when dist > 2 * optimalDistance) has been removed. That cutoff was the primary cause of node clustering: distant nodes received zero repulsion and were never pushed apart. All vertex pairs now repel each other, regardless of distance.
  • c_rep = c3 = 1.0 per Eades (1984). The inlined Eades path in layoutForceDirectedSpringEmbedder() uses the same value directly.

For the FR model: uses the grid-variant with a 2*optimalDistance cutoff radius, as described by Fruchterman & Reingold (1991).

Parameters
modelLayout model identifier: "Eades" or "FR".
distEuclidean distance between the two vertices (canvas pixels).
optimalDistanceThe natural/optimal inter-vertex spacing for the current graph.
Returns
Repulsive force magnitude (negative, i.e. pushing apart).

◆ layoutForceDirected_FR_moveNodes()

qreal Graph::layoutForceDirected_FR_moveNodes ( const qreal & temperature)

Moves all vertices to their new positions as computed by the Fruchterman-Reingold model.

Called once per iteration from layoutForceDirectedFruchtermanReingold(). Limits each vertex's displacement to the current temperature value, which decreases with each iteration to act as a simulated annealing cooling schedule, then clamps the result to the visible canvas area.

Node positions are updated in-memory only (setX/setY). The caller is responsible for emitting setNodePos signals in a single bulk pass after the iteration loop completes — this avoids N×maxIterations signal emissions to the graphics scene.

Parameters
temperatureCurrent annealing temperature, controlling the maximum displacement per iteration. Computed by layoutForceDirected_FR_temperature().

◆ layoutForceDirected_FR_temperature()

qreal Graph::layoutForceDirected_FR_temperature ( const int iteration) const

Reduces the temperature as the layout approaches a better configuration.

Returns
qreal temperature

◆ layoutForceDirectedFruchtermanReingold()

void Graph::layoutForceDirectedFruchtermanReingold ( const int maxIterations)

Embeds a Force Directed Placement layout according to the Fruchterman-Reingold model. Fruchterman and Reingold (1991) refined the Spring Embedder model by replacing the forces. In this model, "the vertices behave as atomic particles or celestial bodies, exerting attractive and repulsive forces on one another." (ibid). Again, only vertices that are neighbours attract each other but, unlike Spring Embedder, all vertices repel each other. These forces induce movement. The algorithm might resemble molecular or planetary simulations, sometimes called n-body problems.

Parameters
maxIterations

◆ layoutForceDirectedKamadaKawai()

void Graph::layoutForceDirectedKamadaKawai ( const int maxIterations = 500,
const bool considerWeights = false,
const bool inverseWeights = false,
const bool dropIsolates = false,
const QString & initialPositions = "current" )

Embeds a Force Directed Placement layout according to the Kamada-Kawai model. In this model, the network is considered to be a dynamic system where every two actors are 'particles' mutually connected by a 'spring'. Each spring has a desirable length, which corresponds to their graph theoretic distance. In this way, the optimal layout of the graph is the state with the minimum imbalance. The degree of imbalance is formulated as the total spring energy: the square summation of the differences between desirable distances and real ones for all pairs of particles Initially, the particles/actors are placed on the vertices of a regular n-polygon.

◆ layoutForceDirectedSpringEmbedder()

void Graph::layoutForceDirectedSpringEmbedder ( const int maxIterations)

Embeds a Force Directed Placement layout according to the initial Spring Embedder model proposed by Eades.

Parameters
maxIterationsMaximum number of iterations to run. The loop may exit earlier if the layout converges (max displacement falls below epsilon).

The Spring Embedder model (Eades, 1984), part of the Force Directed Placement (FDP) family, assigns forces to all vertices and edges: non-adjacent node pairs repel each other via an inverse-square law (analogous to Coulomb's law), while adjacent pairs attract via a logarithmic spring — deliberately not Hooke's law, which Eades argued causes clumping at large distances. These forces are applied to the nodes iteratively, pulling them closer together or pushing them further apart, until the system comes to an equilibrium state (node positions do not change anymore).

Implementation notes:

  • Adjacency is pre-cached into a QSet<QPair<int,int>> before the iteration loop to avoid O(log N) edgeExists() calls inside the O(N²) inner loop.
  • Repulsion and attraction math is inlined directly (no QString model dispatch per call).
  • Vertex numbers are cached to local ints before the inner loop.
  • A linear cooling schedule decreases c4 from c4_init to c4_min over maxIterations, damping displacement progressively so the layout settles rather than oscillating.
  • Early exit when max displacement in an iteration falls below epsilon (convergence).

◆ layoutRadialRandom()

void Graph::layoutRadialRandom ( const bool & guides = true)

Repositions all nodes on the periphery of different circles with random radius.

Parameters
x0
y0
maxRadius

◆ layoutRandom()

void Graph::layoutRandom ( )

Repositions all nodes on random positions Emits setNodePos(i, x,y) to tell GW that the node item should be moved.

Parameters
maxWidth
maxHeight

◆ layoutRandomInMemory()

void Graph::layoutRandomInMemory ( )
private

Repositions all vertices at random coordinates without emitting any signals.

Used internally by force-directed layout algorithms (Eades, FR) to set up initial particle positions before the iteration loop begins. Since the iteration loop will immediately overwrite these positions and emits a bulk setNodePos pass at the end, there is no need to signal the graphics scene here.

For the standalone random layout action (with progress dialog and scene update), use layoutRandom() instead.

◆ layoutVertexSizeByIndegree()

void Graph::layoutVertexSizeByIndegree ( )

Convenience method Changes the size of all nodes to be proportional to their InDegree (Degree Prestige) Calls layoutByProminenceIndex.

◆ layoutVertexSizeByOutdegree()

void Graph::layoutVertexSizeByOutdegree ( )

Convenience method Changes the size of all nodes to be proportional to their outDegree (Degree Centrality) Calls layoutByProminenceIndex.

◆ loadFile()

void Graph::loadFile ( const QString fileName,
const QString codecName,
const int fileFormat,
const QString delimiter = QString(),
const int sm_two_mode = 1,
const bool sm_has_labels = false )

Loads a graph from a given file.

It creates a new Parser object, moves it to a another thread, connects signals and slots and calls its run() method.

Parameters
fileName
codecName
m_showLabels
maxWidth
maxHeight
fileFormat
sm_two_mode
Returns

◆ matrixAdjacency()

Matrix & Graph::matrixAdjacency ( )
inline

◆ matrixAdjacencyInverse()

Matrix & Graph::matrixAdjacencyInverse ( )
inline

◆ matrixCliqueCoMembership()

Matrix & Graph::matrixCliqueCoMembership ( )
inline

◆ matrixDistances()

Matrix & Graph::matrixDistances ( )
inline

◆ matrixReachability()

Matrix & Graph::matrixReachability ( )
inline

◆ matrixTotalWalks()

Matrix & Graph::matrixTotalWalks ( )
inline

◆ matrixWalks()

Matrix & Graph::matrixWalks ( )
inline

◆ minmax()

void Graph::minmax ( qreal C,
GraphVertex * v,
qreal & max,
qreal & min,
int & maxNode,
int & minNode )
private

Computes minimum and maximum centralities during graphDistancesGeodesic().

Parameters
C
v
max
min
maxNode
minNode

◆ moveToThreadFacade()

void Graph::moveToThreadFacade ( QThread * thread)

◆ notConnectedPairsClear()

void Graph::notConnectedPairsClear ( )

◆ notConnectedPairsInsert()

void Graph::notConnectedPairsInsert ( int from,
int to )

◆ notConnectedPairsSize()

int Graph::notConnectedPairsSize ( ) const

◆ notifyEdgesVisibilityBatch()

void Graph::notifyEdgesVisibilityBatch ( const QList< EdgeVisibilityChange > & changes)

Plain relay to signalSetEdgesVisibilityBatch, for GraphVertex to notify the UI layer of many edges' visibility changes as a single queued dispatch. See #WS3 M2.

◆ notifyEdgeVisibilityChanged()

void Graph::notifyEdgeVisibilityChanged ( const int & relation,
const int & source,
const int & target,
const bool & toggle,
const bool & preserveReverseEdge = false,
const int & edgeWeight = 1,
const int & reverseEdgeWeight = 1 )

Plain relay to signalSetEdgeVisibility, for GraphVertex (a QtCore-only value class, not a QObject) to notify the UI layer of a single edge's visibility change. See #WS3 M2.

◆ numberOfTriples()

qreal Graph::numberOfTriples ( int v1)

Returns the number of triples of vertex v1 A triple Υ at a vertex v is a path of length two for which v is the center vertex.

◆ prestigeDegree()

void Graph::prestigeDegree ( const bool & considerWeights,
const bool & dropIsolates = false )

Computes the Degree Prestige (in-degree) of each vertex - diagonal included Also the mean value and the variance of the in-degrees.

Meaning: prestige measures flip centrality's question around - instead of "how many ties does this actor have," they ask "how many ties point *at* this actor." Degree prestige is the simplest version: how many others chose to connect to this actor, ignoring how many connections the actor made outward. Meaningless on an undirected graph, where in- and out-ties are the same thing.

When to use: directed networks where "being chosen by others" is the thing worth measuring

  • citation counts, follower counts, nomination/endorsement data - and a quick raw count is enough (see PageRank Prestige below when the quality of who's choosing you also matters).

Compare to: Degree Centrality (DC, see centralityDegree()) is this same raw-count idea for outbound ties (or all ties, on an undirected graph).

Weights: no inversion choice here (considerWeights only) - when considered, weights are summed directly, so a stronger inbound tie always adds more.

Math: DP(i) = number of inbound edges to i (or their summed weights, if weights are considered). Standardized SDP(i) = DP(i) / (N-1).

Parameters
weights
dropIsolates

◆ prestigePageRank()

void Graph::prestigePageRank ( const bool & dropIsolates = false)

Calculates the PageRank Prestige of each vertex.

Meaning: the same idea Google originally used to rank web pages - an actor is prestigious if prestigious actors point to it. Unlike plain degree prestige (which treats every inbound tie equally), a link from someone with few outbound ties and high prestige counts for much more than one of a hundred outbound ties from someone unremarkable, and that prestige keeps circulating until every score stabilizes.

When to use: directed networks where endorsement quality matters, not just quantity - web links, citation networks, recommendation/referral graphs - anywhere "an endorsement from someone important should count for more."

Compare to: Degree Prestige (DP) counts inbound ties equally; PageRank weighs each one by the endorser's own prestige divided by their out-degree. Eigenvector Centrality (EVC, see centralityEigenvector()) is the closest centrality-side analogue - both are "importance feeds back on itself" measures - but EVC is built for undirected/symmetric graphs while PageRank is built for directed graphs with an explicit damping factor.

Weights: no considerWeights/inverseWeights choice at all - every inbound link always counts as weight 1, normalized by the endorser's out-degree (see Math below), regardless of any edge weight set on the graph.

Math: iteratively, PRP(i) = (1-d)/N + d * Sum_j( PRP(j) / outLinks(j) ) for every j linking to i, where d is the damping factor (0.85, matching Google's original choice) and N is the number of actors. Repeated until scores stop changing by more than a small delta.

Parameters
dropIsolates

◆ prestigeProximity()

void Graph::prestigeProximity ( const bool considerWeights = false,
const bool inverseWeights = false,
const bool dropIsolates = false )

Computes Proximity Prestige of each vertex Also the mean value and the variance of it..

Meaning: how close everyone else who can reach this actor actually is, on average - prestige's answer to closeness centrality. It rewards being easy to reach and being reachable by a large share of the network, so an actor reachable by only a couple of very close others still scores lower than one reachable, at moderate distance, by almost everyone.

When to use: directed networks where you want a refined "how sought-after is this actor" score that accounts for distance, not just a raw inbound-tie count (see Degree Prestige for the simpler version).

Compare to: Influence Range Closeness Centrality (IRCC, see centralityClosenessIR()) is this same idea from the centrality side (distance to others) rather than prestige's (distance from others), and likewise works on disconnected graphs.

Weights: shortest-path-based, same as CC/IRCC - if a weight represents value/strength, invert it so a strong tie behaves like a short/cheap path.

Math: for actor i, let I_i be the set of actors that can reach i (its influence domain). PP(i) = [ |I_i| / (V-1) ] / [ (sum of d(j,i) for j in I_i) / |I_i| ] - the fraction of the network that can reach i, divided by their average distance to i.

◆ progressCanceled()

bool Graph::progressCanceled ( ) const

Returns true if the user has requested cancellation via the progress dialog.

◆ progressStatus()

void Graph::progressStatus ( const QString & msg)
protected

Emits a status message to be shown in the UI status bar.

Parameters
msgThe message to be shown.

◆ prominenceDistribution()

void Graph::prominenceDistribution ( const int & index,
const ChartType & type,
const QString & distImageFileName = QString() )

Computes the distribution of a centrality index score. The distribution is stored as Qt Series depending on the SeriesType parameter type It is send to MW through signal/slot.

Parameters
index
type

◆ prominenceDistributionArea()

void Graph::prominenceDistributionArea ( const H_StrToInt & discreteClasses,
const QString & name,
const QString & distImageFileName )

Computes prominence distribution data and delegates Area chart rendering.

Performs the algorithmic portion only:

  • Orders (value, frequency) pairs derived from discreteClasses
  • Computes min/max value and min/max frequency

UI construction (Qt Charts series/axes), optional PNG export, and emission of signalPromininenceDistributionChartUpdate(...) are delegated to the UI façade implementation in graph_ui_prominence_distribution.cpp (WS2/F4).

Behavior and output semantics are preserved.

Parameters
discreteClassesMap of value (string) -> frequency.
nameDisplay name of the series.
distImageFileNameIf non-empty, export chart to this PNG file.

◆ prominenceDistributionBars()

void Graph::prominenceDistributionBars ( const H_StrToInt & discreteClasses,
const QString & name,
const QString & distImageFileName )

Computes the prominence distribution and delegates Bar chart rendering.

This method performs only the algorithmic portion: it derives ordered category labels (centrality values formatted with 6 decimals), the matching frequencies, and computes basic range statistics:

  • min/max value (numeric)
  • min/max frequency

UI construction (Qt Charts objects, axes, optional PNG export) and emission of the update signal to MainWindow are delegated to the UI façade layer (graph_ui_prominence_distribution.cpp), following WS2/F4 rules.

Behavior, rendering semantics, and export output remain unchanged.

Parameters
discreteClassesA map of centrality value (as string) to frequency.
nameThe display name of the distribution series.
distImageFileNameIf non-empty, the chart is exported to this PNG file.

◆ prominenceDistributionSpline()

void Graph::prominenceDistributionSpline ( const H_StrToInt & discreteClasses,
const QString & seriesName,
const QString & distImageFileName )

Computes prominence distribution data and delegates Spline chart rendering.

Performs the algorithmic portion only:

  • Orders (value, frequency) pairs derived from discreteClasses
  • Computes min/max value and min/max frequency

UI construction (Qt Charts series/axes), optional PNG export, and emission of signalPromininenceDistributionChartUpdate(...) are delegated to the UI façade implementation in graph_ui_prominence_distribution.cpp (WS2/F4).

Behavior and output semantics are preserved.

Parameters
discreteClassesMap of value (string) -> frequency.
seriesNameDisplay name of the series.
distImageFileNameIf non-empty, export chart to this PNG file.

◆ randomizeThings()

void Graph::randomizeThings ( )

Adds a little universal randomness :).

RANDOM NETWORKS

◆ randomNetErdosCreate()

bool Graph::randomNetErdosCreate ( const int & N,
const QString & model,
const int & m,
const qreal & p,
const QString & mode,
const bool & diag )

Creates an Erdős–Rényi random network.

Supports two models:

  • G(n,p): each possible edge is included independently with probability p.
  • G(n,M): exactly M edges are placed at random among all possible pairs.
Parameters
NNumber of nodes.
model"G(n,p)" or "G(n,M)".
mNumber of edges (used in G(n,M) model; 0 for G(n,p)).
pEdge probability (used in G(n,p) model; 0 for G(n,M)).
mode"graph" for undirected, anything else for directed.
diagIf true, self-loops are allowed.
Returns
true on success, false if the user cancelled.

◆ randomNetLatticeCreate()

bool Graph::randomNetLatticeCreate ( const int & N,
const int & length,
const int & dimension,
const int & neighborhoodLength,
const QString & mode,
const bool & circular )

Creates a lattice (mesh/grid) random network.

Nodes are arranged in a length×length grid. Each node connects to its neighbours within a given neighbourhood distance in both horizontal and vertical directions. The resulting network forms a regular tiling pattern.

Note: the dimension and circular parameters are reserved for future extension to higher-dimensional and toroidal lattices.

Parameters
NTotal number of nodes (should equal length^2).
lengthNumber of nodes along each dimension of the grid.
dimensionReserved for future use (higher-dimensional lattices).
neighborhoodLengthDistance within which nodes are connected.
mode"graph" for undirected, anything else for directed.
circularReserved for future use (toroidal/circular lattice).
Returns
true on success, false if the user cancelled.

◆ randomNetRegularCreate()

bool Graph::randomNetRegularCreate ( const int & N,
const int & degree,
const QString & mode,
const bool & diag )

Creates a pseudo-random d-regular network.

Every node ends up with exactly degree neighbours. The algorithm:

  1. Build an initial ordered edge list where each node i connects to the next degree/2 nodes (undirected) or degree nodes (directed).
  2. Repeatedly pick two edges at random and swap their endpoints, ensuring no self-loops or duplicate edges result, until all edges have been processed. This produces a random regular graph.
  3. Draw the resulting edges.
Parameters
NNumber of nodes.
degreeDesired degree of every node (must be even for undirected).
mode"graph" for undirected, anything else for directed.
diagReserved, currently unused.
Returns
true on success, false if the user cancelled.

◆ randomNetRingLatticeCreate()

bool Graph::randomNetRingLatticeCreate ( const int & N,
const int & degree,
const bool updateProgress = false )

Creates a random ring lattice network.

Parameters
vert
degree
x0
y0
radius
updateProgress

◆ randomNetScaleFreeCreate()

bool Graph::randomNetScaleFreeCreate ( const int & N,
const int & power,
const int & m0,
const int & m,
const qreal & alpha,
const QString & mode )

Creates a Barabási–Albert scale-free random network.

The algorithm works in two phases:

  1. Seed: build a fully connected clique of m0 initial nodes.
  2. Growth: add nodes one by one up to N, each connecting to m existing nodes via preferential attachment — nodes with higher degree are more likely to receive new edges (rich-get-richer effect).

The attachment probability for node j is: P(j) = (alpha + degree(j)^power) / sumDegrees

Parameters
NTotal number of nodes in the final network.
powerExponent of the preferential attachment (typically 1).
m0Number of nodes in the initial seed clique.
mNumber of edges each new node attaches to existing nodes.
alphaAdditive constant in the attachment probability (zero-appeal).
mode"graph" for undirected, anything else for directed.
Returns
true on success, false if the user cancelled.

◆ randomNetSmallWorldCreate()

bool Graph::randomNetSmallWorldCreate ( const int & N,
const int & degree,
const double & beta,
const QString & mode )

Creates a Watts–Strogatz small-world random network.

The algorithm works in two phases:

  1. Build a ring lattice of N nodes each connected to degree neighbours.
  2. Rewire each edge with probability beta to a randomly chosen node, producing the characteristic short path lengths and high clustering.
Parameters
NNumber of nodes.
degreeNumber of neighbours each node is initially connected to (must be even).
betaRewiring probability in [0,1]. 0 = pure lattice, 1 = random graph.
mode"graph" for undirected, anything else for directed.
Returns
true on success, false if the user cancelled.

◆ relationAdd()

void Graph::relationAdd ( const QString & relName,
const bool & changeRelation = false )

Adds a new relation to the graph.

Adds a new relation named relName, emitting signal to MW UI, and optionally changing current graph relation to the new one. Called by file parser and various Graph methods, i.e clear() etc.

Parameters
relName

◆ relationAddCocitation()

void Graph::relationAddCocitation ( )

Creates a new symmetric relation by connecting those actors that are cocitated by others. In the new relation, an edge will exist between actor i and actor j only if C(i,j) > 0, where C the Cocitation Matrix. Thus the actor pairs cited by more common neighbors will appear with a stronger tie between them than pairs those cited by fewer common neighbors. The resulting relation is symmetric.

◆ relationCurrent

int Graph::relationCurrent ( )
slot

Gets the current relation number.

Returns
int

◆ relationCurrentName

QString Graph::relationCurrentName ( ) const
slot

Gets the current relation name.

Returns
string

◆ relationCurrentRename [1/2]

void Graph::relationCurrentRename ( const QString & newName)
slot

Overload. Renames current relation to newName, without emitting any signal to MW.

Parameters
newName

◆ relationCurrentRename [2/2]

void Graph::relationCurrentRename ( const QString & newName,
const bool & signalMW )
slot

Renames current relation to newName, optionally emitting a signal to MW.

Parameters
newName

◆ relationNext

void Graph::relationNext ( )
slot

Changes graph to next relation.

◆ relationPrev

void Graph::relationPrev ( )
slot

Changes graph to previous relation.

◆ relations()

int Graph::relations ( )

Returns the count of relationships in this Graph.

Returns
int

◆ relationsClear()

void Graph::relationsClear ( )

Clears relationships in this Graph.

◆ relationSet

void Graph::relationSet ( int relNum = RAND_MAX,
const bool & updateUI = true )
slot

Changes the current relation, and optionally emits signals to MW/GW (default: true).

Slots to signals from MainWindow

Forces all enabled vertices to disable edges in the old relation and enable edges of the new relation

Then, if updateUI==true (default), it emits signals to MW and GW to update the MW UI and toggle the edges on the GW, respectivelly.

Called from Parser, Graph methods and when the user selects a relation in the MW combo box.

Parameters
relNumint
updateUIbool

◆ resetDistanceAggregates()

void Graph::resetDistanceAggregates ( )

◆ resetDistanceCentralityCacheFlags()

void Graph::resetDistanceCentralityCacheFlags ( )

◆ resetProgressCanceled()

void Graph::resetProgressCanceled ( )

Resets the cancellation status.

◆ resolveClasses() [1/2]

void Graph::resolveClasses ( qreal C,
H_StrToInt & discreteClasses,
int & classes )
private

Checks if score C is a new prominence class If yes, it stores that number in a QHash<QString,int> type where the score is the key. If no, increases the frequency of this prominence score by 1 Called from graphDistancesGeodesic().

Parameters
C
discreteClasses
classes

◆ resolveClasses() [2/2]

void Graph::resolveClasses ( qreal C,
H_StrToInt & discreteClasses,
int & classes,
int vertex )
private

Overloaded method. It only adds displaying current vertex for debugging purposes.

Parameters
C
discreteClasses
classes
vertex

◆ runOnGuiThread()

void Graph::runOnGuiThread ( std::function< void()> fn)
protected

Runs fn on the application's main/GUI thread, regardless of the calling thread.

Exists because Graph's own thread affinity is graphThread (see moveToThreadFacade()), but some UI façade code (currently: the prominence-distribution chart builders in graph_ui_prominence_distribution.cpp) constructs real Qt GUI objects — QtCharts series/axes, QChartView::grab() for PNG export — which is only ever safe on the main/GUI thread, per Qt's single-threaded-GUI rule. Those objects would otherwise inherit whichever thread happens to be calling in, which is graphThread whenever this is reached from algorithm-slice code (layouts, report generation, etc.) that now genuinely executes there (see #254).

Uses QCoreApplication::instance() rather than the qApp macro (which force-casts to QApplication*) so this stays correct in the headless CLI, where only a QCoreApplication is constructed - never a QApplication. Qt::AutoConnection (the default, used explicitly here for clarity) resolves to a direct, synchronous call when already on the target thread - which is always true for the CLI, since it never creates a second thread - so this has no behavioural or performance effect there. In GUI mode, called from graphThread, it resolves to queued delivery on the next GUI event loop iteration.

Parameters
fnThe work to run on the main/GUI thread.

◆ saveToAdjacencyFormat()

bool Graph::saveToAdjacencyFormat ( const QString & fileName,
const bool & saveEdgeWeights = true )

Saves the active graph to an adjacency-formatted file.

Parameters
fileName
Returns
bool

◆ saveToDotFormat()

bool Graph::saveToDotFormat ( const QString & fileName)

Saves the active graph (current relation) to a GraphViz DOT file.

Produces a valid digraph or graph block. Node identifiers are n<num> to avoid issues with labels that contain spaces or special characters. All standard visual properties (label, color, shape) and custom node/edge attributes are written as DOT attribute lists so the file round-trips through parseAsDot() without data loss.

Only the currently active relation is exported. If the graph has multiple relations the caller is responsible for warning the user before invoking this method.

Parameters
fileNameDestination file path.
Returns
true on success, false if the file could not be opened.

◆ saveToEdgeListSimpleFormat()

bool Graph::saveToEdgeListSimpleFormat ( const QString & fileName)

Saves the active relation to a simple (unweighted) edge list file.

Format: one edge per line — "source target" — using the node label as identifier (spaces in labels replaced with underscores). A comment header line describes the columns.

Only the currently active relation is exported.

Parameters
fileNameDestination file path.
Returns
true on success, false if the file cannot be opened.

◆ saveToEdgeListWeightedFormat()

bool Graph::saveToEdgeListWeightedFormat ( const QString & fileName)

Saves the active relation to a weighted edge list file.

Format: one edge per line — "source target weight" — using the node label as identifier (spaces in labels replaced with underscores). A comment header line describes the columns.

Only the currently active relation is exported.

Parameters
fileNameDestination file path.
Returns
true on success, false if the file cannot be opened.

◆ saveToFile()

void Graph::saveToFile ( const QString & fileName,
const int & fileType,
const bool & saveEdgeWeights = true,
const bool & saveZeroWeightEdges = false )

Saves the current graph to a file.

Checks the requested file type and calls the corresponding saveGraphTo...() method

Parameters
fileName
fileType

◆ saveToGraphMLFormat()

bool Graph::saveToGraphMLFormat ( const QString & fileName,
const bool & saveZeroWeightEdges = false,
QString networkName = "",
int maxWidth = 0,
int maxHeight = 0 )

Saves the current graph to a GraphML-formatted file.

Parameters
fileName
networkName
maxWidth
maxHeight
Returns
bool

◆ saveToPajekFormat()

bool Graph::saveToPajekFormat ( const QString & fileName,
QString networkName = "",
int maxWidth = 0,
int maxHeight = 0 )

Save the current graph to a Pajek (.paj) file.

Writes:

  • *Network <name>
  • *Vertices N with labels, colors, positions, and shapes (as available)
  • Edges either as:
    • single-relation: *Arcs + *Edges sections (legacy behavior), or
    • multi-relation: one *Matrix block per relation.

Relation header export (multi-relation):

  • Canonical matrix header syntax:
    • *Matrix :k
    • *Matrix :k "Label"
  • If the relation label is empty/unlabeled, no quotes are emitted.
  • Labels are normalized to avoid polluted forms like 9 'star':
    • strips wrapping quotes
    • strips a leading index token (e.g. 9, 9:)
    • escapes internal quotes per Pajek convention (" -> "")

Notes:

  • Numeric output is written using the C locale for stable decimal formatting.
  • maxWidth/maxHeight are used to scale vertex coordinates to Pajek's normalized coordinate space. If 0, current canvas dimensions are used.
  • The active relation is restored before returning.
  • On success, updates the graph’s file name and file format metadata.
Parameters
fileNameOutput file path (should end in .paj).
networkNameOptional exported network name. If empty, uses graph name. If "unnamed", derives from file name without extension.
maxWidthCanvas width used to normalize X coordinates (0 => use current).
maxHeightCanvas height used to normalize Y coordinates (0 => use current).
Returns
true on success, false if the file cannot be opened/written.

Returns a canonical label for Pajek *Matrix headers (no surrounding quotes).

Pajek *Matrix Header Export Contract

EXPORT IS STRICT AND CANONICAL.

Multirelational headers MUST be written in exactly one of these forms:

*Matrix :k *Matrix :k "Label"

Where:

  • k is the 1-based relation index.
  • No leading index is embedded in the label.
  • No empty quotes are emitted.
  • No alternate forms like "*Matrix k:", "*Matrix k: """, etc.

Relation labels are normalized before export:

  • Strip wrapping quotes.
  • Strip leading index pollution (e.g. "9 'star'" → "star").
  • Treat empty or index-only labels as unlabeled.
  • Escape internal double quotes as "" (Pajek rule).

IMPORT remains tolerant. EXPORT remains canonical.

◆ saveToUCINETDLFormat()

bool Graph::saveToUCINETDLFormat ( const QString & fileName)

Saves the current graph to a UCINET DL file (FULLMATRIX format).

Emits one header block followed by all relation matrices back-to-back in the DATA section. The parser advances its relation counter whenever the source row counter exceeds N, so no separator is needed between matrices.

Single relation: N=<n>, no NM or LEVEL LABELS. Multi-relation: N=<n> NM=<m>, LEVEL LABELS block with relation names.

Node labels are always written in ROW LABELS / COLUMN LABELS sections. Edge weights are written as-is (0 for absent edges).

Parameters
fileNameDestination file path.
Returns
true on success, false if the file cannot be opened.

◆ setAverageDistanceCached()

void Graph::setAverageDistanceCached ( qreal v)

◆ setConnectedCached()

void Graph::setConnectedCached ( bool v)

◆ setDiameterCached()

void Graph::setDiameterCached ( int v)

◆ setDirected()

void Graph::setDirected ( const bool & toggle = true,
const bool & signalMW = true )

Toggles the graph directed or undirected.

Parameters
toggle
signalMW

◆ setEdgeColor

void Graph::setEdgeColor ( const int & v1,
const int & v2,
const QString & color )
signal

◆ setEdgeLabel

void Graph::setEdgeLabel ( const int & v1,
const int & v2,
const QString & label )
signal

◆ setEdgeWeight

void Graph::setEdgeWeight ( const int & v1,
const int & v2,
const qreal & weight )
signal

◆ setFileFormat()

void Graph::setFileFormat ( const int & fileFormat)

◆ setFileName()

void Graph::setFileName ( const QString & fileName)

Sets the file name of the current graph.

Parameters
fileName

◆ setModStatus()

void Graph::setModStatus ( const int & graphNewStatus,
const bool & signalMW = true )

Sets the graph modification status.

If there are major changes or new network, it signals to MW to update the UI.

Parameters
intgraphNewStatus
boolsignalMW

◆ setName()

void Graph::setName ( const QString & graphName)

Sets the name of the current graph.

Parameters
graphName

◆ setNodeColor

void Graph::setNodeColor ( const int & v,
const QString & color )
signal

◆ setNodeLabel

void Graph::setNodeLabel ( const int & v,
const QString & label )
signal

◆ setNodeLabelColor

void Graph::setNodeLabelColor ( const int & v,
const QString & color )
signal

◆ setNodeLabelDistance

void Graph::setNodeLabelDistance ( const int & v,
const int & distance )
signal

◆ setNodeLabelSize

void Graph::setNodeLabelSize ( const int & v,
const int & size )
signal

◆ setNodeNumberColor

void Graph::setNodeNumberColor ( const int & v,
const QString & color )
signal

◆ setNodeNumberDistance

void Graph::setNodeNumberDistance ( const int & v,
const int & distance )
signal

◆ setNodeNumberSize

void Graph::setNodeNumberSize ( const int & v,
const int & size )
signal

◆ setNodePos

void Graph::setNodePos ( const int & ,
const qreal & ,
const qreal &  )
signal

◆ setNodeShape

void Graph::setNodeShape ( const int & v,
const QString & shape,
const QString & iconPath = QString() )
signal

◆ setNodeSize

void Graph::setNodeSize ( const int & v,
const int & size )
signal

◆ setReportsChartType()

void Graph::setReportsChartType ( const int & type)

Sets the chart type in reports.

Parameters
type

◆ setReportsDataDir()

void Graph::setReportsDataDir ( const QString & dir)

Sets the directory where reports are saved This is used when exporting prominence distribution images to be used in HTML reports.

Parameters
dir

◆ setReportsLabelLength()

void Graph::setReportsLabelLength ( const int & length)

Sets the length of labels in reports.

Parameters
length

◆ setReportsOutputFormat()

void Graph::setReportsOutputFormat ( const int & format)

Sets the output format (HTML or CSV) new reports are written in.

Parameters
format

◆ setReportsRealNumberPrecision()

void Graph::setReportsRealNumberPrecision ( const int & precision)

Sets the precision (number of fraction digits) the app will use when writing real numbers in reports.

Parameters
precision

◆ setSelectionChanged

void Graph::setSelectionChanged ( const QList< int > selectedVertices,
const QList< SelectedEdge > selectedEdges )
slot

Sets the user-selected vertices and edges.

Usually called from GW, it emits selection counts to MW

Parameters
selectedVertices
selectedEdges

◆ setSymmetric()

void Graph::setSymmetric ( )

Transforms the graph to symmetric (all edges reciprocal).

◆ setSymmetricCached()

void Graph::setSymmetricCached ( bool v)

◆ setUndirected()

void Graph::setUndirected ( const bool & toggle = true,
const bool & signalMW = true )

Makes the graph undirected or directed.

Parameters
toggle
signalMW

◆ setVertexVisibility

void Graph::setVertexVisibility ( const int & number,
const bool & toggle )
signal

◆ setWeighted()

void Graph::setWeighted ( const bool & toggle = true)

Sets the graph to be weighted ( valued edges ).

Parameters
toggle

◆ showZeroWeightEdgesSet()

void Graph::showZeroWeightEdgesSet ( const bool & toggle)

◆ sign()

int Graph::sign ( const qreal & D)

Graph::sign returns the sign of number D as integer (1 or -1).

Parameters
D
Returns

◆ signalDatasetDescription

void Graph::signalDatasetDescription ( QString )
signal

◆ signalDrawEdge

void Graph::signalDrawEdge ( const int & v1,
const int & v2,
const qreal & weight,
const QString & label = "",
const QString & color = "black",
const int & type = 0,
const bool & drawArrows = true,
const bool & bezier = false,
const bool & weightNumbers = false )
signal

◆ signalDrawNode

void Graph::signalDrawNode ( const QPointF & p,
const int & num,
const int & size,
const QString & nodeShape,
const QString & nodeIconPath,
const QString & nodeColor,
const QString & numberColor,
const int & numSize,
const int & numDistance,
const QString & label,
const QString & labelColor,
const int & labelSize,
const int & labelDistance )
signal

Signals to GraphicsWidget

◆ signalEdgeClicked

void Graph::signalEdgeClicked ( const MyEdge & edge = MyEdge(),
const bool & openMenu = false )
signal

◆ signalEdgeType

void Graph::signalEdgeType ( const int & v1,
const int & v2,
const int & type )
signal

◆ signalGraphDirectedChanged

void Graph::signalGraphDirectedChanged ( const bool & directed)
signal

◆ signalGraphLoaded

void Graph::signalGraphLoaded ( const int & fileType,
const QString & fileName = QString(),
const QString & netName = QString(),
const int & totalNodes = 0,
const int & totalLinks = 0,
const qreal & density = 0,
const qint64 & elapsedTime = 0,
const QString & message = QString() )
signal

◆ signalGraphModified

void Graph::signalGraphModified ( const bool & undirected,
const int & vertices,
const int & edges,
const qreal & density,
const bool & notSaved = true )
signal

◆ signalGraphSavedStatus

void Graph::signalGraphSavedStatus ( const int & status)
signal

◆ signalLayoutFinished

void Graph::signalLayoutFinished ( )
signal

◆ signalNetworkManagerRequest

void Graph::signalNetworkManagerRequest ( const QUrl & currentUrl,
const NetworkRequestType & type )
signal

Signals to MainWindow

◆ signalNodeClickedInfo

void Graph::signalNodeClickedInfo ( const int & number = 0,
const QPointF & p = QPointF(),
const QString & label = QString(),
const int & inDegree = 0,
const int & outDegree = 0 )
signal

◆ signalNodesFound

void Graph::signalNodesFound ( const QList< int > foundList)
signal

◆ signalPromininenceDistributionChartUpdate

void Graph::signalPromininenceDistributionChartUpdate ( QAbstractSeries * series,
QAbstractAxis * axisX = Q_NULLPTR,
const qreal & min = 0,
const qreal & max = 0,
QAbstractAxis * axisY = Q_NULLPTR,
const qreal & minF = 0,
const qreal & maxF = 0 )
signal

◆ signalRelationAddToMW

void Graph::signalRelationAddToMW ( const QString & newRelation)
signal

◆ signalRelationChangedToGW

void Graph::signalRelationChangedToGW ( int )
signal

◆ signalRelationChangedToMW

void Graph::signalRelationChangedToMW ( const int & relIndex = RAND_MAX)
signal

◆ signalRelationRenamedToMW

void Graph::signalRelationRenamedToMW ( const QString & newRelName)
signal

◆ signalRelationsClear

void Graph::signalRelationsClear ( )
signal

◆ signalRemoveEdge

void Graph::signalRemoveEdge ( const int & v1,
const int & v2,
const bool & removeReverse )
signal

◆ signalRemoveNode

void Graph::signalRemoveNode ( int )
signal

◆ signalSelectionChanged

void Graph::signalSelectionChanged ( const int & selectedVertices,
const int & selectedEdges )
signal

◆ signalSetEdgesVisibilityBatch

void Graph::signalSetEdgesVisibilityBatch ( const QList< EdgeVisibilityChange > & changes)
signal

◆ signalSetEdgeVisibility

void Graph::signalSetEdgeVisibility ( const int & relation,
const int & source,
const int & target,
const bool & toggle,
const bool & preserveReverseEdge = false,
const int & edgeWeight = 1,
const int & reverseEdgeWeight = 1 )
signal

◆ signalWebCrawlParse

void Graph::signalWebCrawlParse ( QNetworkReply * reply)
signal

◆ slotCancelComputation

void Graph::slotCancelComputation ( )
slot

Slot called by MainWindow when the user clicks Cancel in the progress dialog.

◆ slotHandleCrawlerRequestReply

void Graph::slotHandleCrawlerRequestReply ( )
slot

Gets the reply of a MW network request made by Web Crawler, and emits that reply as is to the Web Crawler.

◆ startWebCrawler

void Graph::startWebCrawler ( const QUrl & startUrl,
const QStringList & urlPatternsIncluded,
const QStringList & urlPatternsExcluded,
const QStringList & linkClasses,
const int & maxNodes,
const int & maxLinksPerPage,
const bool & intLinks,
const bool & childLinks,
const bool & parentLinks,
const bool & selfLinks,
const bool & extLinksIncluded,
const bool & extLinksCrawl,
const bool & socialLinks,
const bool & delayedRequests )
slot

Creates a new WebCrawler, that will parse the downloaded HTML code of each webpage we download. Moves the WebCrawler to a new thread and starts the thread. Then creates the fist node (initial url), and starts the web spider to download the first HTML page. Called by MW with user options.

Parameters
startUrl
urlPatternsIncluded
urlPatternsExcluded
linkClasses
maxNodes
maxLinksPerPage
intLinks
childLinks
parentLinks
selfLinks
extLinksIncluded
extLinksCrawl
socialLinks
delayedRequests

◆ statusMessage

void Graph::statusMessage ( const QString & message)
signal

◆ subgraphExtract

Graph * Graph::subgraphExtract ( const QString & name,
const bool & includeCustomAttributes = true )
slot

Extracts currently visible (non-filtered) nodes and their inter-edges into an independent Graph copy.

Collects all enabled vertices, then delegates to subgraphFromVertexList().

Parameters
nameName assigned to the new graph.
includeCustomAttributesWhen true, node and edge custom attribute maps are copied verbatim.
Returns
Heap-allocated Graph* containing the subgraph, or nullptr if no visible vertices exist.

◆ subgraphExtractFromSelection

Graph * Graph::subgraphExtractFromSelection ( const QString & name,
const bool & includeCustomAttributes = true )
slot

Extracts currently selected nodes and their inter-edges into an independent Graph copy.

Uses the current canvas selection (getSelectedVertices()), then delegates to subgraphFromVertexList(). Only edges between selected nodes are included.

Parameters
nameName assigned to the new graph.
includeCustomAttributesWhen true, node and edge custom attribute maps are copied verbatim.
Returns
Heap-allocated Graph* containing the subgraph, or nullptr if no nodes are selected.

◆ subgraphFromVertexList()

Graph * Graph::subgraphFromVertexList ( const QList< int > & vertexNums,
const QString & name,
const bool & includeCustomAttributes = true )
private

Core helper: builds an independent Graph copy from an explicit list of vertex numbers.

private member functions

Shared by subgraphExtract() (visible nodes) and subgraphExtractFromSelection() (selected nodes). Vertices are renumbered from 1. For every relation, enabled edges whose both endpoints are in vertexNums are copied. All visual properties and, when includeCustomAttributes is true, node and edge custom attribute maps are preserved verbatim.

The caller takes ownership of the returned Graph object.

Parameters
vertexNumsSource vertex numbers to include.
nameName assigned to the new graph.
includeCustomAttributesWhen true, node and edge custom attribute maps are copied verbatim.
Returns
Heap-allocated Graph* containing the subgraph, or nullptr if vertexNums is empty.

◆ symmetricCached()

bool Graph::symmetricCached ( ) const

◆ triadType_examine_MAN_label()

void Graph::triadType_examine_MAN_label ( int mut,
int asy,
int nul,
GraphVertex * vert1,
GraphVertex * vert2,
GraphVertex * vert3 )

Examines the triad type (in Mutual-Asymmetric-Null label format) and increases by one the proper frequency element inside QList::triadTypeFreqs

◆ uiProminenceDistributionArea()

void Graph::uiProminenceDistributionArea ( const QVector< QPair< qreal, qreal > > & points,
const qreal min,
const qreal max,
const qreal minF,
const qreal maxF,
const QString & name,
const QString & distImageFileName )
protected

◆ uiProminenceDistributionBars()

void Graph::uiProminenceDistributionBars ( const QStringList & categories,
const QVector< qreal > & frequencies,
const qreal min,
const qreal max,
const qreal minF,
const qreal maxF,
const QString & name,
const QString & distImageFileName )
protected

◆ uiProminenceDistributionSpline()

void Graph::uiProminenceDistributionSpline ( const QVector< QPair< qreal, qreal > > & points,
qreal min,
qreal max,
qreal minF,
qreal maxF,
const QString & seriesName,
const QString & distImageFileName )
protected

◆ vertexAtIndex() [1/2]

GraphVertex * Graph::vertexAtIndex ( int idx)

Returns the vertex at a given index.

Parameters
idx
Returns
GraphVertex*

◆ vertexAtIndex() [2/2]

const GraphVertex * Graph::vertexAtIndex ( int idx) const

Returns the vertex at a given index.

Parameters
idx
Returns
GraphVertex*

◆ vertexAttributesImport()

int Graph::vertexAttributesImport ( const QStringList & headers,
const QVector< QStringList > & rows,
int idColumn,
bool matchByLabel )

Imports custom attributes from a parsed table into existing vertices.

Each row in rows is matched to a vertex either by node number (matchByLabel == false) or by label (matchByLabel == true) using the value in column idColumn. All other columns become custom attributes on the matched vertex. Rows that do not match any vertex are silently skipped.

Example — CSV input with idColumn=0, matchByLabel=false. Native columns are routed to their proper setters (Label, Size, Color, Shape); only Visible is silently skipped (it is a filter state, not a persistent attribute):

#,Label,Size,Color,type,year_founded
1,Alice,12,#ff0000,investor,2010 ← Label/Size/Color updated; type/year_founded → custom attrs
2,Bob,10,#0000ff,founder,2018
Returns
Number of vertices that received at least one attribute update.

◆ vertexClicked()

int Graph::vertexClicked ( ) const

Returns the number of the clicked vertex.

Returns
int

◆ vertexClickedSet

void Graph::vertexClickedSet ( const int & v1,
const QPointF & p )
slot

Sets the clicked vertex.

Signals to MW to show node info on the status bar.

Parameters
v1
p

◆ vertexColor()

QColor Graph::vertexColor ( const int & v1) const

Graph::vertexColor.

Parameters
v1
Returns

◆ vertexColorInit()

void Graph::vertexColorInit ( const QString & color)

Graph::vertexColorInit default vertex color initialization.

Parameters
color

◆ vertexColorSet()

void Graph::vertexColorSet ( const int & v1,
const QString & color )

Changes the color of vertex v1.

Parameters
v1
color

◆ vertexComponentId()

const QHash< int, int > & Graph::vertexComponentId ( ) const
inline

◆ vertexCreate

void Graph::vertexCreate ( const int & number,
const int & size,
const QString & color,
const QString & numColor,
const int & numSize,
const QString & label,
const QString & labelColor,
const int & labelSize,
const QPointF & p,
const QString & shape,
const QString & iconPath = QString(),
const bool & signalMW = false,
const QHash< QString, QString > & customAttributes = QHash<QString, QString>() )
slot

Creates a new vertex.

Slots to signals from Parser

Main vertex creation slot, associated with homonymous signal from Parser. Adds a vertex to the Graph and signals drawNode to GW The new vertex has number num and specific color, label, label color, shape and position p.

Parameters
num
size
nodeColor
numColor
numSize
label
lColor
lSize
p
nodeShape
signalMW

◆ vertexCreateAtPos

void Graph::vertexCreateAtPos ( const QPointF & p)
slot

Creates a new vertex in the given position.

Called from GW, with i and p as parameters. Calls the main creation slot with init node values.

Parameters
QPointFThe clicked pos of the new node.

◆ vertexCreateAtPosRandom

void Graph::vertexCreateAtPosRandom ( const bool & signalMW = false)
slot

Creates a new randomly positioned vertex with default values.

Computes a random position p inside the useable canvas area Then calls the main creation slot with init node values.

Parameters
bool

◆ vertexCreateAtPosRandomWithLabel

void Graph::vertexCreateAtPosRandomWithLabel ( const int & i,
const QString & label,
const bool & signalMW = false )
slot

Creates a new randomly positioned vertex with specific number and label. All other values are from the defaults.

Called from WebCrawler and Parser with parameters label and i. Computes a random position p the useable canvas area Then calls the main creation slot with init node values.

Parameters
i
label
signalMW

◆ vertexCustomAttributeRemove()

void Graph::vertexCustomAttributeRemove ( const int & v1,
const QString & key )

Removes a single custom attribute key from vertex v1. Does nothing if the key does not exist.

Parameters
v1Vertex number.
keyAttribute key to remove.

◆ vertexCustomAttributes()

QHash< QString, QString > Graph::vertexCustomAttributes ( const int & v1) const

Retrieves the vertex at the position specified by the index v1 from the vpos map and calls its customAttributes method.

Parameters
v1The index of the vertex whose custom attributes are to be accessed.

◆ vertexCustomAttributeSet()

void Graph::vertexCustomAttributeSet ( const int & v1,
const QString & key,
const QString & value )

Sets a single custom attribute key/value on vertex v1, leaving all other attributes untouched.

Parameters
v1Vertex number.
keyAttribute key.
valueAttribute value.

◆ vertexCustomAttributesSet()

void Graph::vertexCustomAttributesSet ( const int & v1,
const QHash< QString, QString > & customAttributes )

Sets custom attributes for a specified vertex.

This function assigns a set of custom attributes to a vertex identified by its index. It also updates the modification status to indicate that vertex metadata has been changed.

Parameters
v1The index of the vertex for which custom attributes are being set.
customAttributesA QHash containing the custom attributes to be set for the vertex. The keys and values of the QHash are both QStrings.

◆ vertexDegreeIn()

int Graph::vertexDegreeIn ( int v1)

Returns the inDegree (sum of inbound edge weights) of vertex v1.

Parameters
v1
Returns

◆ vertexDegreeOut()

int Graph::vertexDegreeOut ( int v1)

Returns the outDegree (sum of outbound edge weights) of vertex v1.

Parameters
v1
Returns

◆ vertexEdgesInbound()

int Graph::vertexEdgesInbound ( int v1)

Returns the number of inbound edges (arcs) to vertex v1.

Parameters
v1
Returns
int

◆ vertexEdgesOutbound()

int Graph::vertexEdgesOutbound ( int v1)

Returns the number of outbound edges (arcs) from vertex v1.

Parameters
v1
Returns

◆ vertexExists() [1/2]

bool Graph::vertexExists ( const int & v1)

Checks if the given vertex exists in the graph.

Parameters
vertexnumber
Returns
true if it exists

◆ vertexExists() [2/2]

bool Graph::vertexExists ( const QString & label)

Checks if there is a vertex with a specific label in the graph.

Parameters
label
Returns
true if it exists

◆ vertexFilterByAttribute

void Graph::vertexFilterByAttribute ( const FilterCondition & cond)
slot

Shows only vertices whose custom attribute satisfies cond; all other vertices are hidden.

Non-destructive: pushes a GraphVisibilitySnapshot onto m_visibilityHistory before making any changes. Call vertexFilterRestoreAll() to undo.

Returns early with a status message if the resulting visible set is empty.

Parameters
condThe filter condition (key, operator, value).

◆ vertexFilterByCentrality

void Graph::vertexFilterByCentrality ( const float threshold,
const bool overThreshold,
const IndexType centralityIndex )
slot

Filters vertices by their score on the given centrality or prestige index.

Pushes a GraphVisibilitySnapshot onto m_visibilityHistory before making any changes, so vertexFilterRestoreAll() can undo this filter.

Performs two passes over the graph:

  • Pass 1: Enables or disables each vertex depending on whether its score satisfies the threshold condition. Emits setVertexVisibility for every vertex whose state changes.
  • Pass 2: Updates all edges. An edge is made visible only when both its source and target vertices are enabled after pass 1. Emits signalSetEdgeVisibility for every out-edge of every vertex.

The two-pass design is required so that edge visibility can be determined correctly: during pass 2 all vertices are already in their final enabled state, so both endpoints of any edge can be queried reliably.

Returns early with a status message if the requested index has not been computed yet — the user should run the corresponding analysis first.

Parameters
thresholdScore threshold to compare against.
overThresholdIf true, disable vertices with score >= threshold; if false, disable vertices with score <= threshold.
centralityIndexThe centrality or prestige index to use, as defined by the IndexType enum in global.h.
See also
isCentralityIndexComputed()
vertexFilterRestoreAll()
IndexType

◆ vertexFilterByEgoNetwork

void Graph::vertexFilterByEgoNetwork ( const int v1,
const int depth = 1 )
slot

Saves current visibility state and shows only the ego network of vertex v1 at the given depth.

Non-destructive: pushes a GraphVisibilitySnapshot onto m_visibilityHistory before making any changes. Call vertexFilterRestoreAll() to undo.

Only out-edges in the current relation are used to determine neighbors. Works correctly for both directed and undirected graphs.

Parameters
v1The ego vertex (center of the neighborhood).
depthNeighborhood depth (currently only depth=1 supported).

◆ vertexFilterByQuery

void Graph::vertexFilterByQuery ( const GraphQuery & query)
slot

Shows only vertices whose custom attributes satisfy ALL conditions in query.

AND logic: a vertex must pass every condition to remain visible. Non-destructive: pushes a GraphVisibilitySnapshot with FilterSpec::Type::Query before making any changes. Undo via vertexFilterRemoveAt() or vertexFilterRestoreAll().

Follows the same two-pass pattern as vertexFilterByAttribute() so edge visibility is resolved after all vertex states are final.

Parameters
queryCompound query; all conditions should have Scope::Nodes.

◆ vertexFilterBySelection

void Graph::vertexFilterBySelection ( const QList< int > & selectedVertices)
slot

Saves current visibility state and shows only the selected vertices and the edges between them.

Non-destructive: pushes a GraphVisibilitySnapshot onto m_visibilityHistory before making any changes. Call vertexFilterRestoreAll() to undo.

Implements the "Focus on Selection" mode (#210): all nodes not in selectedVertices are hidden, and only edges whose both endpoints are in the selection remain visible.

Parameters
selectedVerticesList of vertex numbers that should remain visible.

◆ vertexFilterRemoveAt

void Graph::vertexFilterRemoveAt ( int stackIndex)
slot

Removes the filter at stackIndex (0 = oldest) and replays the rest.

Drains m_visibilityHistory to a list, restores to the pre-first-filter base state (the oldest snapshot), then re-applies every spec except the one at stackIndex. Each replay call pushes a fresh snapshot, leaving the stack correct for subsequent single-step restores.

Centrality replay requires the relevant index to still be computed; if it is not, vertexFilterByCentrality() returns early and that step is skipped.

◆ vertexFilterReplaySpec()

void Graph::vertexFilterReplaySpec ( const FilterSpec & spec)
private

Re-applies one filter from its stored replay parameters.

Used by vertexFilterRemoveAt() during stack reconstruction.

◆ vertexFilterRestoreAll

void Graph::vertexFilterRestoreAll ( )
slot

Restores vertex and edge visibility from the top snapshot on the history stack.

If the stack is empty (no filter is active), this is a no-op. Pops the snapshot after restoring, so repeated calls walk back through the filter history one step at a time.

◆ vertexFindByIndexScore()

bool Graph::vertexFindByIndexScore ( const int & index,
const QStringList & thresholds,
const bool & considerWeights,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Finds vertices by their index score.

Parameters
QStringList
Returns

◆ vertexFindByLabel()

bool Graph::vertexFindByLabel ( const QStringList & labelList)

Finds vertices by their label.

Parameters
QStringList
Returns

◆ vertexFindByNumber()

bool Graph::vertexFindByNumber ( const QStringList & numList)

Finds vertices in strList by their number.

Parameters
QStringList
Returns

◆ vertexIndexByNumber()

int Graph::vertexIndexByNumber ( int v) const

Returns the index of a vertex by its number.

Returns the vpos or -1

Complexity: O(logN) for vpos retrieval

Parameters
vertexnumber
Returns
vertex pos or -1

◆ vertexIndexIfExists() [1/2]

int Graph::vertexIndexIfExists ( const int & v1)

Returns the internal position of the given vertex in m_graph, if it exists.

Complexity: O(logN) for vpos retrieval

Parameters
vertexnumber
Returns
vertex pos or -1

◆ vertexIndexIfExists() [2/2]

int Graph::vertexIndexIfExists ( const QString & label)

Returns the internal position of the vertex with the given label, if it exists.

Complexity: O(N)

Parameters
label
Returns
vertex pos or -1

◆ vertexIsolated()

bool Graph::vertexIsolated ( const int & v1) const

Checks if vertex is isolated.

Parameters
v1
Returns

◆ vertexIsolatedAllToggle

void Graph::vertexIsolatedAllToggle ( const bool & toggle)
slot

Toggles the status of all isolated vertices (those without links).

For each isolate vertex in the Graph, emits the setVertexVisibility signal

Parameters
toggle

◆ vertexLabel()

QString Graph::vertexLabel ( const int & v) const

Returns the label of a vertex v1.

Parameters
v1
Returns

◆ vertexLabelColorInit()

void Graph::vertexLabelColorInit ( QString color)

Graph::vertexLabelColorInit Changes the default vertex label color.

Parameters
color

◆ vertexLabelColorSet()

void Graph::vertexLabelColorSet ( const int & v1,
const QString & color )

Changes the label color of vertex v1 or all vertices if v1 = 0.

Parameters
v1
color

◆ vertexLabelDistanceAllSet()

void Graph::vertexLabelDistanceAllSet ( const int & newDistance)

Changes the distance of all vertex labels from their vertices.

Parameters
size

◆ vertexLabelDistanceInit()

void Graph::vertexLabelDistanceInit ( const int & distance)

Changes the default distance of vertex labels.

Parameters
distance

◆ vertexLabelDistanceSet()

void Graph::vertexLabelDistanceSet ( const int & v,
const int & newDistance )

Changes the distance.of vertex v label from the vertex.

Parameters
v
size

◆ vertexLabelSet()

void Graph::vertexLabelSet ( const int & v1,
const QString & label )

Changes the label of a vertex v1.

Parameters
v1
label

◆ vertexLabelSizeInit()

void Graph::vertexLabelSizeInit ( int newSize)

Graph::vertexLabelSizeInit Changes the default size of vertex labels.

Parameters
newSize

◆ vertexLabelSizeSet()

void Graph::vertexLabelSizeSet ( const int & v1,
const int & labelSize )

Changes the label size of vertex v1 or all vertices if v1=0.

Parameters
v1
size

◆ vertexLabelsVisibilitySet()

void Graph::vertexLabelsVisibilitySet ( bool toggle)

◆ vertexNumberColorInit()

void Graph::vertexNumberColorInit ( const QString & color)

Changes the initial color of the vertex numbers.

Parameters
color

◆ vertexNumberColorSet()

void Graph::vertexNumberColorSet ( const int & v1 = 0,
const QString & color = "#000000" )

Graph::vertexColorSet Changes the color of vertex v1.

Parameters
v1
color

◆ vertexNumberDistanceInit()

void Graph::vertexNumberDistanceInit ( const int & distance)

Changes the initial distance of vertex numbers.

Parameters
distance

◆ vertexNumberDistanceSet()

void Graph::vertexNumberDistanceSet ( const int & v,
const int & newDistance )

Changes the distance.of vertex v number from the vertex.

Parameters
v
size

◆ vertexNumberMax()

int Graph::vertexNumberMax ( )

Returns the number of the last vertex in the graph.

Returns
int

◆ vertexNumberMin()

int Graph::vertexNumberMin ( )

Returns the number of the first vertex in the graph.

Returns
int

◆ vertexNumberSizeInit()

void Graph::vertexNumberSizeInit ( const int & size)

Changes the initial size of vertex numbers.

Parameters
size

◆ vertexNumberSizeSet()

void Graph::vertexNumberSizeSet ( const int & v,
const int & size )

Changes the size of vertex v number.

Parameters
v
size

◆ vertexOutNeighborsSet()

QSet< int > Graph::vertexOutNeighborsSet ( const int & v1,
const bool includeInEdges = false )

Returns the set of all 1-hop neighbors of vertex v1 in the current relation.

By default returns only out-neighbors (vertices reachable via enabled out-edges). When includeInEdges is true, also includes in-neighbors (vertices that have an enabled out-edge to v1), giving the full set of adjacent nodes regardless of edge direction.

Only edges in the current relation that are enabled are considered.

Parameters
v1The vertex number to query.
includeInEdgesIf true, union of out- and in-neighbors is returned. Default: false (out-neighbors only).
Returns
QSet<int> of neighbor vertex numbers.

◆ vertexPos()

QPointF Graph::vertexPos ( const int & v1) const

Returns the position of the given vertex.

Parameters
v1
Returns

◆ vertexPosSet()

void Graph::vertexPosSet ( const int & v1,
const int & x,
const int & y )

Changes the position of the given vertex.

Called from MW/GW when node moves to update its position

Parameters
v1
x
y

◆ vertexPtr()

GraphVertex * Graph::vertexPtr ( const int v)

◆ vertexReciprocalNeighborsList()

QList< int > Graph::vertexReciprocalNeighborsList ( const int & v1)

Returns a list of all vertices reciprocally connected to vertex v1 in the current relation.

A vertex is included only if there is an enabled, reciprocal edge between v1 and that vertex in the current relation. For general 1-hop neighbors (out-edges only), iterate m_outEdges directly.

Parameters
v1The vertex number to query.
Returns
QList<int> of reciprocally connected vertex numbers.

◆ vertexReciprocalNeighborsSet()

QSet< int > Graph::vertexReciprocalNeighborsSet ( const int & v1)

Returns the set of all vertices reciprocally connected to vertex v1 in the current relation.

A vertex is included only if there is an enabled, reciprocal edge between v1 and that vertex in the current relation. For general 1-hop neighbors (out-edges only), iterate m_outEdges directly.

Parameters
v1The vertex number to query.
Returns
QSet<int> of reciprocally connected vertex numbers.

◆ vertexRemove()

void Graph::vertexRemove ( const int & v1)

Removes the vertex v1 from the graph First, it removes all edges to doomed from other vertices Then it changes the vpos of all subsequent vertices inside m_graph Finally, it removes the vertex.

Parameters
intv1

◆ vertexRemoveDummyNode

void Graph::vertexRemoveDummyNode ( int i)
slot

Deletes a dummy node.

This is called from Parser (as pajek) to delete any redundant (dummy) nodes.

Parameters
inti number of node

◆ vertexShape()

QString Graph::vertexShape ( const int & v1)

Returns the shape of this vertex.

Parameters
v1
Returns

◆ vertexShapeIconPath()

QString Graph::vertexShapeIconPath ( const int & v1)

Returns the IconPath of vertex v1.

Parameters
v1
Returns

◆ vertexShapeSet()

void Graph::vertexShapeSet ( const int & v1,
const QString & shape,
const QString & iconPath = QString() )

Changes the shape and iconPath of vertex v1, or all vertices if v1=-1.

Parameters
v1
shape
iconPath

◆ vertexShapeSetDefault()

void Graph::vertexShapeSetDefault ( const QString shape,
const QString & iconPath = QString() )

Sets the default vertex shape and iconPath.

Parameters
shape
iconPath

◆ vertexSize()

int Graph::vertexSize ( const int & v) const

Returns the size of vertex v.

Parameters
v
Returns
int

◆ vertexSizeInit()

void Graph::vertexSizeInit ( const int size)

Sets the initial vertex size.

Parameters
size

◆ vertexSizeSet()

void Graph::vertexSizeSet ( const int & v,
const int & size )

Changes the size of a vertex v or all vertices if v=0.

Called from MW (i.e. user changing node properties)

Parameters
v
size

◆ vertices()

int Graph::vertices ( const bool & dropIsolates = false,
const bool & countAll = false,
const bool & recount = false )

Gets the number of vertices in the graph.

If countAll = true, returns |V| where V the set of all (enabled or not) vertices If countAll = false, it skips disabled vertices If countAll = false and dropIsolates = true, it skips both disabled and isolated vertices

The cache is keyed on (dropIsolates, countAll): a cached count computed under one combination of flags must never be handed back to a caller asking with a different combination, since callers size fixed allocations off this return value (see #274).

Parameters
dropIsolates
countAll
Returns

◆ verticesBegin()

VList::const_iterator Graph::verticesBegin ( ) const

iterator helpers

◆ verticesCreateSubgraph()

void Graph::verticesCreateSubgraph ( QList< int > vList,
const int & type = SUBGRAPH_CLIQUE,
const int & center = 0 )

Creates a subgraph (clique, star, cycle, line) with vertices in vList Iff vList is empty, then fallbacks to the m_verticesSelected.

Parameters
vList

◆ verticesEnd()

VList::const_iterator Graph::verticesEnd ( ) const

◆ verticesList()

QList< int > Graph::verticesList ( )

Returns a list of all vertices numbers inside the graph.

Returns
QList<int>

◆ verticesListIsolated()

QList< int > Graph::verticesListIsolated ( )

Returns a list of all isolated vertices inside the graph.

Returns
QList<int>

◆ verticesSet()

QSet< int > Graph::verticesSet ( )

Returns a QSet of all vertices numbers inside the graph.

Returns

◆ verticesWithInboundEdges()

int Graph::verticesWithInboundEdges ( )

Returns the sum of vertices having edgesInbound.

Returns

◆ verticesWithOutboundEdges()

int Graph::verticesWithOutboundEdges ( )

Returns the sum of vertices having edgesOutbound.

Returns

◆ verticesWithReciprocalEdges()

int Graph::verticesWithReciprocalEdges ( )

Returns the sum of vertices having reciprocal edges.

Returns

◆ visibilityHistoryEmpty

bool Graph::visibilityHistoryEmpty ( ) const
slot

Returns true if the visibility history stack is empty.

Used by the UI to determine whether a "Restore All" action should be enabled. The stack holds one entry per non-destructive filter operation (e.g. ego network focus). Each call to vertexFilterRestoreAll() pops one entry; when the stack is empty, there is nothing left to restore.

Returns
true if no filter snapshots are pending, false otherwise.
See also
vertexFilterByEgoNetwork()
vertexFilterRestoreAll()

◆ walksBetween()

int Graph::walksBetween ( int v1,
int v2,
int length )

Calculates and returns the number of walks of a given length between v1 and v2.

Parameters
v1
v2
length
Returns

◆ webCrawlTerminateThreads()

void Graph::webCrawlTerminateThreads ( QString reason)

called from Graph, when closing network, to terminate all crawler processes Also called indirectly when wc_spider finishes

Parameters
reason

◆ webSpider

void Graph::webSpider ( )
slot

A loop, that takes urls awaiting in front of the urlQueue, and signals to the MW to make the network request.

◆ writeCentralityBetweenness()

bool Graph::writeCentralityBetweenness ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes Betweenness centralities to file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCentralityBonacich()

bool Graph::writeCentralityBonacich ( const QString fileName,
const qreal & alpha,
const qreal & beta,
const bool & weigths = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false,
const int & format = ReportFormat::Html )

◆ writeCentralityCloseness()

bool Graph::writeCentralityCloseness ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the closeness centralities to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCentralityClosenessInfluenceRange()

bool Graph::writeCentralityClosenessInfluenceRange ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the "improved" closeness centrality indices to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCentralityDegree()

bool Graph::writeCentralityDegree ( const QString fileName,
const bool considerWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the Degree Centrality to a file.

Parameters
fileName
considerWeights
dropIsolates

◆ writeCentralityEccentricity()

bool Graph::writeCentralityEccentricity ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the Eccentricity centralities (aka Harary Graph Centrality) to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCentralityEigenvector()

bool Graph::writeCentralityEigenvector ( const QString fileName,
const bool & considerWeights = true,
const bool & inverseWeights = false,
const bool & dropIsolates = false,
const int & format = ReportFormat::Html )

Writes the eigenvector centralities to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCentralityInformation()

bool Graph::writeCentralityInformation ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const int & format = ReportFormat::Html )

Writes the information centralities to file.

Parameters
fileName
considerWeights
inverseWeights

◆ writeCentralityKatz()

bool Graph::writeCentralityKatz ( const QString fileName,
const qreal & alpha,
const bool & considerWeights = false,
const bool & inverseWeights = false,
const bool & dropIsolates = false,
const int & format = ReportFormat::Html )

Writes the Katz Centrality report to a file, then displays it.

Parameters
fileName
alpha
considerWeights
inverseWeights
dropIsolates
format

◆ writeCentralityPower()

bool Graph::writeCentralityPower ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes Power Centralities to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCentralityStress()

bool Graph::writeCentralityStress ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the Stress centralities to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeCliqueCensus()

bool Graph::writeCliqueCensus ( const QString & fileName,
const bool considerWeights )

Calls graphCliques() to compute all cliques (maximal connected subgraphs) of the network. Then writes the results into a file, along with the Actor by clique analysis, the Co-membership matrix and the Hierarchical clustering of overlap matrix.

Parameters
fileName
considerWeights

Write the actor by clique analysis matrix. For each actor-clique pair, we compute the proportion of clique members adjacent

Write the actor by actor analysis matrix. For each pair, we compute their clique co-membership

Write the Hierarchical clustering of overlap matrix

◆ writeClusteringCoefficient()

bool Graph::writeClusteringCoefficient ( const QString fileName,
const bool considerWeights,
const int & format = ReportFormat::Html )

Writes the clustering coefficients to a file.

Parameters
fileName
considerWeights

◆ writeClusteringHierarchical()

bool Graph::writeClusteringHierarchical ( const QString & fileName,
const QString & varLocation,
const QString & matrix = "Adjacency",
const QString & metric = "Manhattan",
const QString & method = "Complete",
const bool & diagonal = false,
const bool & dendrogram = false,
const bool & considerWeights = true,
const bool & inverseWeights = false,
const bool & dropIsolates = false )

Performs Hierarchical Cluster Analysis (HCA) and writes the results to an HTML report file.

The analysis proceeds in three phases:

  1. Build the structural equivalence matrix (adjacency or geodesic distances).
  2. Run the hierarchical clustering algorithm on the equivalence matrix.
  3. Write the HTML report including the equivalence matrix and dendrogram.
Parameters
fileNamePath to the output HTML report file.
varLocationWhether variables are in rows or columns ("rows"/"cols").
matrixInput matrix type: "adjacency" or "distances".
metricDistance/dissimilarity metric (e.g., "euclidean", "manhattan").
methodClustering linkage method (e.g., "single", "complete", "average").
diagonalIf true, include the diagonal of the matrix in computations.
dendrogramIf true, include dendrogram output in the report.
considerWeightsIf true, edge weights are used in distance computations.
inverseWeightsIf true, edge weights are inverted before use.
dropIsolatesIf true, isolate nodes are excluded from the analysis.
Returns
true on success, false if the computation was cancelled or an error occurred.

◆ writeClusteringHierarchicalResultsToStream()

void Graph::writeClusteringHierarchicalResultsToStream ( QTextStream & outText,
const int N,
const bool & dendrogram = false )

Writes Hierarchical Clustering results to given output stream Before running this method, the method Graph::graphClusteringHierarchical() must execute and return true. Otherwise, the result is unpredictable...

Parameters
outText
N
dendrogram

◆ writeDataSetToFile()

void Graph::writeDataSetToFile ( const QString dir,
const QString fileName )

Writes a "famous" dataset to the given file Datasets are hardcoded! They are exported in the given fileName...

TODO: Move all these datasets to a separate class

Parameters
fileName

◆ writeEccentricity()

bool Graph::writeEccentricity ( const QString fileName,
const bool considerWeights = false,
const bool inverseWeights = false,
const bool dropIsolates = false,
const int & format = ReportFormat::Html )

Writes the Eccentricity report to file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeGeodesicDistribution()

bool Graph::writeGeodesicDistribution ( const QString & fileName,
const bool & considerWeights = false,
const bool & inverseWeights = false )

Writes a geodesic distance distribution report to an HTML file.

Computes the distribution via graphGeodesicDistanceDistribution() (cache-aware), then writes a sortable HTML table (distance | pair count | % | cumulative %) to fileName.

Parameters
fileNameFull path of the output HTML file.
considerWeightsPassed through to graphGeodesicDistanceDistribution().
inverseWeightsPassed through to graphGeodesicDistanceDistribution().
Returns
true on success; false if the file could not be opened.

◆ writeMatrix()

bool Graph::writeMatrix ( const QString & fn,
const int & matrix = MATRIX_ADJACENCY,
const bool & considerWeights = true,
const bool & inverseWeights = false,
const bool & dropIsolates = false,
const QString & varLocation = "Rows",
const bool & simpler = false,
const int & format = ReportFormat::Html )

Computes and writes the specified matrix of the social network to an HTML report file.

Supported matrix types: adjacency, laplacian, degree, geodesic distances, shortest paths (geodesics), inverse adjacency, reachability, transpose, cocitation, and tie-profile distance matrices (Euclidean, Hamming, Jaccard, Manhattan, Chebyshev).

Parameters
fnPath to the output HTML report file.
matrixMatrix type constant (e.g., MATRIX_ADJACENCY, MATRIX_DISTANCES).
considerWeightsIf true, edge weights are used in distance computations.
inverseWeightsIf true, edge weights are inverted before use.
dropIsolatesIf true, isolate nodes are excluded from the analysis.
varLocationWhether variables are in rows or columns ("rows"/"cols"), used for tie-profile distance matrices.
simplerReserved for future use.
Returns
true on success, false if the computation was cancelled or an error occurred.

◆ writeMatrixAdjacency()

bool Graph::writeMatrixAdjacency ( const QString fn,
const bool & markDiag = true,
const int & format = ReportFormat::Html )

Writes the adjacency matrix of G to a specified file fn

◆ writeMatrixAdjacencyPlot()

void Graph::writeMatrixAdjacencyPlot ( const QString fn,
const bool & simpler = false )

Writes a visual representation of the adjacency matrix of the graph to the specified file.

The resulting matrix HAS NO spaces between elements.

Parameters
fn
simpler

◆ writeMatrixAdjacencyTo()

void Graph::writeMatrixAdjacencyTo ( QTextStream & os,
const bool & saveEdgeWeights = true )

Exports the adjacency matrix to a given textstream

◆ writeMatrixCSVTable()

void Graph::writeMatrixCSVTable ( QTextStream & outText,
Matrix & M,
const bool & printInfinity = true,
const bool & dropIsolates = false )

Writes the matrix M as a comma-separated table to the specified text stream outText.

CSV sibling of writeMatrixHTMLTable() (same vertex filtering, same RAND_MAX/large-magnitude/ precision value-formatting rules), but lean: header row of vertex numbers, one data row per vertex, no markup, no min/max summary paragraph - a CSV consumer (spreadsheet app) has no use for prose. Row/column headers are always plain vertex numbers, never labels, so no CSV quoting/escaping is needed here (unlike the per-node score tables planned for centrality/ prestige reports, where free-text labels will need it).

Parameters
outText
M
printInfinity
dropIsolates

◆ writeMatrixDissimilarities()

bool Graph::writeMatrixDissimilarities ( const QString fileName,
const QString & metricStr,
const QString & varLocation,
const bool & diagonal,
const bool & considerWeights,
const int & format = ReportFormat::Html )

Writes dissimilarity matrix based on a metric/measure to given html file.

Parameters
fileName
measure
varLocation
diagonal
considerWeights

◆ writeMatrixHTMLTable()

void Graph::writeMatrixHTMLTable ( QTextStream & outText,
Matrix & M,
const bool & markDiag = true,
const bool & plain = false,
const bool & printInfinity = true,
const bool & dropIsolates = false )

Writes the matrix M as HTML.

specified text stream outText It is the same as Matrix::printHTMLTable except that this method omits disabled vertices, thus the table header is correct

Parameters
outText
M
markDiag
plain
printInfinity

◆ writeMatrixSimilarityMatching()

bool Graph::writeMatrixSimilarityMatching ( const QString fileName,
const QString & measure = "Simple",
const QString & matrix = "adjacency",
const QString & varLocation = "rows",
const bool & diagonal = false,
const bool & considerWeights = true,
const int & format = ReportFormat::Html )

Writes similarity matrix based on a matching measure to given html file.

Parameters
fileName
measure
matrix
varLocation
diagonal
considerWeights

◆ writeMatrixSimilarityPearson()

bool Graph::writeMatrixSimilarityPearson ( const QString fileName,
const bool considerWeights,
const QString & matrix = "adjacency",
const QString & varLocation = "rows",
const bool & diagonal = false,
const int & format = ReportFormat::Html )

Calls Graph::createMatrixSimilarityPearson() and writes Pearson Correlation Coefficients to given file.

Parameters
fileName
considerWeights

◆ writeMatrixWalks()

bool Graph::writeMatrixWalks ( const QString & fn,
const int & length = 0,
const bool & simpler = false,
const int & format = ReportFormat::Html )

Writes the walks of given length matrix to a file in HTML. If length = 0, it writes the Total Walks matrix.

Parameters
fn
length
simpler

◆ writePrestigeDegree()

bool Graph::writePrestigeDegree ( const QString fileName,
const bool considerWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the Degree Prestige of each node to a file.

Parameters
fileName
considerWeights
dropIsolates

◆ writePrestigePageRank()

bool Graph::writePrestigePageRank ( const QString fileName,
const bool dropIsolates = false,
const int & format = ReportFormat::Html )

Writes the PageRank scores of vertices to a file.

Parameters
fileName
dropIsolates

◆ writePrestigeProximity()

bool Graph::writePrestigeProximity ( const QString fileName,
const bool considerWeights,
const bool inverseWeights,
const bool dropIsolates,
const int & format = ReportFormat::Html )

Writes the proximity prestige indices to a file.

Parameters
fileName
considerWeights
inverseWeights
dropIsolates

◆ writeReciprocity()

bool Graph::writeReciprocity ( const QString fileName,
const bool considerWeights = false,
const int & format = ReportFormat::Html )

Writes reciprocity report to filename.

Parameters
fileName
considerWeights

◆ writeScoreTableCSV()

void Graph::writeScoreTableCSV ( QTextStream & outText,
const QStringList & dataColumnHeaders,
const std::function< QVector< qreal >(GraphVertex *)> & rowValues,
const std::function< bool(GraphVertex *)> & isBlanked = nullptr,
const std::function< bool(GraphVertex *)> & isSkipped = nullptr )

CSV sibling of writeScoreTableHTML() - same column shape and semantics, comma-delimited, no HTML markup, same RAND_MAX-as-infinity convention. Reuses TableExport::csvQuote() for the Label column, the only free-text field (Node numbers and scores are always numeric, so they never need escaping).

Parameters
outText
dataColumnHeaders
rowValues
isBlanked
isSkipped

◆ writeScoreTableHTML()

void Graph::writeScoreTableHTML ( QTextStream & outText,
const QStringList & dataColumnHeaders,
const std::function< QVector< qreal >(GraphVertex *)> & rowValues,
const std::function< bool(GraphVertex *)> & isBlanked = nullptr,
const std::function< bool(GraphVertex *)> & isSkipped = nullptr )

Renders a per-node score table as a sortable HTML.

shared by every centrality/prestige report writer (WS16 Step 2) plus Reciprocity/Clustering Coefficient/Eccentricity (WS16 Step 3). "Node" and "Label" are always the first two columns; dataColumnHeaders supplies the rest, in order, and rowValues must return that many values per row, in the same order - a value equal to RAND_MAX renders as the infinity glyph, matching writeMatrixHTMLTable()'s sentinel convention. isBlanked (optional) lets each report keep its own existing isolate-handling: rows for which it returns true get "--" placeholders instead of rowValues's output.

Parameters
outText
dataColumnHeaders
rowValues
isBlanked

◆ writeTriadCensus()

bool Graph::writeTriadCensus ( const QString fileName,
const bool considerWeights,
const int & format = ReportFormat::Html )

◆ DistanceEngine

friend class DistanceEngine
friend

Member Data Documentation

◆ actualDateTime

QDateTime Graph::actualDateTime
private

◆ AM

Matrix Graph::AM
private

◆ averageCLC

qreal Graph::averageCLC
private

◆ calculatedAdjacencyMatrix

bool Graph::calculatedAdjacencyMatrix
private

◆ calculatedBPC

bool Graph::calculatedBPC
private

◆ calculatedCentralities

bool Graph::calculatedCentralities
private

◆ calculatedDC

bool Graph::calculatedDC
private

◆ calculatedDistances

bool Graph::calculatedDistances
private

◆ calculatedDP

bool Graph::calculatedDP
private

◆ calculatedEdges

bool Graph::calculatedEdges
private

◆ calculatedEVC

bool Graph::calculatedEVC
private

◆ calculatedGraphDensity

bool Graph::calculatedGraphDensity
private

◆ calculatedGraphReciprocity

bool Graph::calculatedGraphReciprocity
private

◆ calculatedGraphSymmetry

bool Graph::calculatedGraphSymmetry
private

◆ calculatedGraphWeighted

bool Graph::calculatedGraphWeighted
private

◆ calculatedIC

bool Graph::calculatedIC
private

◆ calculatedIRCC

bool Graph::calculatedIRCC
private

◆ calculatedIsolates

bool Graph::calculatedIsolates
private

◆ calculatedKC

bool Graph::calculatedKC
private

◆ calculatedPP

bool Graph::calculatedPP
private

◆ calculatedPRP

bool Graph::calculatedPRP
private

◆ calculatedTriad

bool Graph::calculatedTriad
private

◆ calculatedVertices

bool Graph::calculatedVertices
private

◆ calculatedVerticesList

bool Graph::calculatedVerticesList
private

◆ calculatedVerticesSet

bool Graph::calculatedVerticesSet
private

◆ canvasHeight

qreal Graph::canvasHeight
private

◆ canvasWidth

qreal Graph::canvasWidth
private

◆ classesBPC

int Graph::classesBPC
private

◆ classesCLC

int Graph::classesCLC
private

◆ classesEC

int Graph::classesEC
private

◆ classesEccentricity

int Graph::classesEccentricity
private

◆ classesEVC

int Graph::classesEVC
private

◆ classesIC

int Graph::classesIC
private

◆ classesIRCC

int Graph::classesIRCC
private

◆ classesKC

int Graph::classesKC
private

◆ classesPP

int Graph::classesPP
private

◆ classesPRP

int Graph::classesPRP
private

◆ classesSBC

int Graph::classesSBC
private

◆ classesSCC

int Graph::classesSCC
private

◆ classesSDC

int Graph::classesSDC
private

◆ classesSDP

int Graph::classesSDP
private

◆ classesSPC

int Graph::classesSPC
private

◆ classesSSC

int Graph::classesSSC
private

◆ CLQM

Matrix Graph::CLQM
private

◆ csRecDepth

int Graph::csRecDepth
private

◆ d_factor

qreal Graph::d_factor
private

◆ denomEC

qreal Graph::denomEC
private

◆ denomEVC

qreal Graph::denomEVC
private

◆ denomIC

qreal Graph::denomIC
private

◆ denomIRCC

qreal Graph::denomIRCC
private

◆ denomPP

qreal Graph::denomPP
private

◆ denomPRC

qreal Graph::denomPRC
private

◆ denomSBC

qreal Graph::denomSBC
private

◆ denomSCC

qreal Graph::denomSCC
private

◆ denomSPC

qreal Graph::denomSPC
private

◆ discreteBCs

H_StrToInt Graph::discreteBCs
private

◆ discreteBPCs

H_StrToInt Graph::discreteBPCs
private

◆ discreteCCs

H_StrToInt Graph::discreteCCs
private

◆ discreteCLCs

H_StrToInt Graph::discreteCLCs
private

◆ discreteDPs

H_StrToInt Graph::discreteDPs
private

used in resolveClasses and graphDistancesGeodesic()

◆ discreteEccentricities

H_StrToInt Graph::discreteEccentricities
private

◆ discreteECs

H_StrToInt Graph::discreteECs
private

◆ discreteEVCs

H_StrToInt Graph::discreteEVCs
private

◆ discreteICs

H_StrToInt Graph::discreteICs
private

◆ discreteIRCCs

H_StrToInt Graph::discreteIRCCs
private

◆ discreteKCs

H_StrToInt Graph::discreteKCs
private

◆ discretePCs

H_StrToInt Graph::discretePCs
private

◆ discretePPs

H_StrToInt Graph::discretePPs
private

◆ discretePRPs

H_StrToInt Graph::discretePRPs
private

◆ discreteSCs

H_StrToInt Graph::discreteSCs
private

◆ discreteSDCs

H_StrToInt Graph::discreteSDCs
private

◆ DM

Matrix Graph::DM
private

◆ edgeReverseWeightTemp

qreal Graph::edgeReverseWeightTemp
private

◆ edgeWeightTemp

qreal Graph::edgeWeightTemp
private

◆ file_parser

Parser* Graph::file_parser
private

◆ file_parserThread

QThread Graph::file_parserThread
private

◆ groupCC

qreal Graph::groupCC
private

◆ groupDC

qreal Graph::groupDC
private

◆ groupDP

qreal Graph::groupDP
private

◆ groupEC

qreal Graph::groupEC
private

◆ groupEVC

qreal Graph::groupEVC
private

◆ groupIRCC

qreal Graph::groupIRCC
private

◆ groupPP

qreal Graph::groupPP
private

◆ groupSBC

qreal Graph::groupSBC
private

◆ groupSC

qreal Graph::groupSC
private

◆ groupSPC

qreal Graph::groupSPC
private

◆ htmlEnd

QString Graph::htmlEnd
private

◆ htmlHead

QString Graph::htmlHead
private

◆ htmlHeadLight

QString Graph::htmlHeadLight
private

◆ inboundEdgesVert

int Graph::inboundEdgesVert
private

◆ initEdgeColor

QString Graph::initEdgeColor
private

◆ initEdgeColorZero

QString Graph::initEdgeColorZero
private

◆ initEdgeLabels

bool Graph::initEdgeLabels
private

◆ initEdgeWeightNumbers

bool Graph::initEdgeWeightNumbers
private

◆ initShowZeroWeightEdges

bool Graph::initShowZeroWeightEdges
private

◆ initVertexColor

QString Graph::initVertexColor
private

◆ initVertexIconPath

QString Graph::initVertexIconPath
private

◆ initVertexLabelColor

QString Graph::initVertexLabelColor
private

◆ initVertexLabelDistance

int Graph::initVertexLabelDistance
private

◆ initVertexLabelSize

int Graph::initVertexLabelSize
private

◆ initVertexNumberColor

QString Graph::initVertexNumberColor
private

◆ initVertexNumberDistance

int Graph::initVertexNumberDistance
private

◆ initVertexNumberSize

int Graph::initVertexNumberSize
private

◆ initVertexShape

QString Graph::initVertexShape
private

◆ initVertexSize

int Graph::initVertexSize
private

◆ invAM

Matrix Graph::invAM
private

◆ invM

Matrix Graph::invM
private

◆ m_apspDist

QHash<int, Matrix> Graph::m_apspDist
private

◆ m_apspSigma

QHash<int, Matrix> Graph::m_apspSigma
private

◆ m_clickedEdge

MyEdge Graph::m_clickedEdge
private

◆ m_cliques

QMultiMap<int, L_int> Graph::m_cliques
private

◆ m_clusteringLevel

QList<qreal> Graph::m_clusteringLevel
private

◆ m_clusterPairNamesPerSeq

QMap<int, V_str> Graph::m_clusterPairNamesPerSeq
private

◆ m_clustersByName

QMap<QString, V_int> Graph::m_clustersByName
private

◆ m_clustersPerSequence

QMap<int, V_int> Graph::m_clustersPerSequence
private

◆ m_crawler_max_urls

int Graph::m_crawler_max_urls
private

◆ m_crawler_visited_urls

int Graph::m_crawler_visited_urls
private

◆ m_curRelation

int Graph::m_curRelation
private

◆ m_fieldWidth

int Graph::m_fieldWidth
private

◆ m_fileFormat

int Graph::m_fileFormat
private

◆ m_fileName

QString Graph::m_fileName
private

◆ m_graph

VList Graph::m_graph
private

◆ m_graphAverageDistance

qreal Graph::m_graphAverageDistance
private

◆ m_graphDensity

qreal Graph::m_graphDensity
private

◆ m_graphDiameter

int Graph::m_graphDiameter
private

◆ m_graphFileFormatExportSupported

QList<int> Graph::m_graphFileFormatExportSupported
private

◆ m_graphGeodesicsCount

qreal Graph::m_graphGeodesicsCount
private

◆ m_graphHasVertexCustomIcons

bool Graph::m_graphHasVertexCustomIcons
private

◆ m_graphIsConnected

bool Graph::m_graphIsConnected
private

◆ m_graphIsDirected

bool Graph::m_graphIsDirected
private

◆ m_graphIsSymmetric

bool Graph::m_graphIsSymmetric
private

◆ m_graphIsWeighted

bool Graph::m_graphIsWeighted
private

◆ m_graphModStatus

int Graph::m_graphModStatus
private

General & initialisation variables

◆ m_graphName

QString Graph::m_graphName
private

◆ m_graphReciprocityArc

qreal Graph::m_graphReciprocityArc
private

◆ m_graphReciprocityDyad

qreal Graph::m_graphReciprocityDyad
private

◆ m_graphReciprocityPairsReciprocated

int Graph::m_graphReciprocityPairsReciprocated
private

◆ m_graphReciprocityPairsTotal

int Graph::m_graphReciprocityPairsTotal
private

◆ m_graphReciprocityTiesNonSymmetric

int Graph::m_graphReciprocityTiesNonSymmetric
private

◆ m_graphReciprocityTiesReciprocated

int Graph::m_graphReciprocityTiesReciprocated
private

◆ m_graphReciprocityTiesTotal

int Graph::m_graphReciprocityTiesTotal
private

◆ m_graphStronglyConnectedComponents

int Graph::m_graphStronglyConnectedComponents
private

◆ m_graphSumDistance

qreal Graph::m_graphSumDistance
private

◆ m_graphWeaklyConnectedComponents

int Graph::m_graphWeaklyConnectedComponents
private

◆ m_lastBonacichAlpha

qreal Graph::m_lastBonacichAlpha = -1
private

Same caching purpose as m_lastKatzAlpha (WS11, #39); -1 means "never computed this session". Alpha is kept positive-only by the dialog so this sentinel is safe - beta (which can be negative) has no sentinel role.

◆ m_lastBonacichBeta

qreal Graph::m_lastBonacichBeta = 0
private

◆ m_lastKatzAlpha

qreal Graph::m_lastKatzAlpha = -1
private

Cache of the last alpha used to compute Katz Centrality, read by layoutByProminenceIndex() (WS11, #10) since the generic layout-by-prominence dispatch has no parameter slot. -1 means "never computed this session".

◆ m_progressCanceled

std::atomic<bool> Graph::m_progressCanceled
private

◆ m_relationsDirected

QList<bool> Graph::m_relationsDirected
private

◆ m_relationsList

QList<QString> Graph::m_relationsList
private

◆ m_reportsChartType

ChartType Graph::m_reportsChartType
private

◆ m_reportsDataDir

QString Graph::m_reportsDataDir
private

◆ m_reportsLabelLength

int Graph::m_reportsLabelLength
private

◆ m_reportsOutputFormat

ReportFormat Graph::m_reportsOutputFormat
private

◆ m_reportsRealPrecision

int Graph::m_reportsRealPrecision
private

◆ m_reserveEdgesPerVertexSize

int Graph::m_reserveEdgesPerVertexSize
private

◆ m_selectedEdges

QList<SelectedEdge> Graph::m_selectedEdges
private

◆ m_totalEdges

int Graph::m_totalEdges
private

◆ m_totalVertices

int Graph::m_totalVertices
private

◆ m_vertexClicked

int Graph::m_vertexClicked
private

◆ m_vertexComponentId

QHash<int,int> Graph::m_vertexComponentId
private

◆ m_vertexPairsNotConnected

QMultiHash<int, int> Graph::m_vertexPairsNotConnected
private

◆ m_vertexPairsUnilaterallyConnected

QHash<int, int> Graph::m_vertexPairsUnilaterallyConnected
private

◆ m_verticesCacheCountAll

bool Graph::m_verticesCacheCountAll = false
private

◆ m_verticesCacheDropIsolates

bool Graph::m_verticesCacheDropIsolates = false
private

◆ m_verticesIsolatedList

QList<int> Graph::m_verticesIsolatedList
private

◆ m_verticesList

QList<int> Graph::m_verticesList
private

◆ m_verticesSelected

QList<int> Graph::m_verticesSelected
private

◆ m_verticesSet

QSet<int> Graph::m_verticesSet
private

◆ m_visibilityHistory

QStack<GraphVisibilitySnapshot> Graph::m_visibilityHistory
private

◆ maxBPC

qreal Graph::maxBPC
private

◆ maxCLC

qreal Graph::maxCLC
private

◆ maxEC

qreal Graph::maxEC
private

◆ maxEccentricity

qreal Graph::maxEccentricity
private

◆ maxEVC

qreal Graph::maxEVC
private

◆ maxIC

qreal Graph::maxIC
private

◆ maxIndexBC

qreal Graph::maxIndexBC
private

◆ maxIndexCC

qreal Graph::maxIndexCC
private

◆ maxIndexEC

qreal Graph::maxIndexEC
private

◆ maxIndexIC

qreal Graph::maxIndexIC
private

◆ maxIndexPC

qreal Graph::maxIndexPC
private

◆ maxIndexSC

qreal Graph::maxIndexSC
private

◆ maxIRCC

qreal Graph::maxIRCC
private

◆ maxKC

qreal Graph::maxKC
private

◆ maxNodeBPC

int Graph::maxNodeBPC
private

◆ maxNodeCLC

int Graph::maxNodeCLC
private

◆ maxNodeDP

int Graph::maxNodeDP
private

◆ maxNodeEC

int Graph::maxNodeEC
private

◆ maxNodeEccentricity

int Graph::maxNodeEccentricity
private

◆ maxNodeEVC

int Graph::maxNodeEVC
private

◆ maxNodeIC

int Graph::maxNodeIC
private

◆ maxNodeIRCC

int Graph::maxNodeIRCC
private

◆ maxNodeKC

int Graph::maxNodeKC
private

◆ maxNodePP

int Graph::maxNodePP
private

◆ maxNodePRP

int Graph::maxNodePRP
private

◆ maxNodeSBC

int Graph::maxNodeSBC
private

◆ maxNodeSCC

int Graph::maxNodeSCC
private

◆ maxNodeSDC

int Graph::maxNodeSDC
private

◆ maxNodeSPC

int Graph::maxNodeSPC
private

◆ maxNodeSSC

int Graph::maxNodeSSC
private

◆ maxPP

qreal Graph::maxPP
private

◆ maxPRP

qreal Graph::maxPRP
private

◆ maxSBC

qreal Graph::maxSBC
private

◆ maxSCC

qreal Graph::maxSCC
private

◆ maxSDC

qreal Graph::maxSDC
private

◆ maxSDP

qreal Graph::maxSDP
private

◆ maxSPC

qreal Graph::maxSPC
private

◆ maxSSC

qreal Graph::maxSSC
private

◆ meanBPC

qreal Graph::meanBPC
private

◆ meanEC

qreal Graph::meanEC
private

◆ meanEVC

qreal Graph::meanEVC
private

◆ meanIC

qreal Graph::meanIC
private

◆ meanIRCC

qreal Graph::meanIRCC
private

◆ meanKC

qreal Graph::meanKC
private

◆ meanPP

qreal Graph::meanPP
private

◆ meanPRP

qreal Graph::meanPRP
private

◆ meanSBC

qreal Graph::meanSBC
private

◆ meanSCC

qreal Graph::meanSCC
private

◆ meanSDC

qreal Graph::meanSDC
private

◆ meanSDP

qreal Graph::meanSDP
private

◆ meanSPC

qreal Graph::meanSPC
private

◆ meanSSC

qreal Graph::meanSSC
private

◆ minBPC

qreal Graph::minBPC
private

◆ minCLC

qreal Graph::minCLC
private

◆ minEC

qreal Graph::minEC
private

◆ minEccentricity

qreal Graph::minEccentricity
private

◆ minEVC

qreal Graph::minEVC
private

◆ minIC

qreal Graph::minIC
private

◆ minIRCC

qreal Graph::minIRCC
private

◆ minKC

qreal Graph::minKC
private

◆ minNodeBPC

int Graph::minNodeBPC
private

◆ minNodeCLC

int Graph::minNodeCLC
private

◆ minNodeDP

int Graph::minNodeDP
private

◆ minNodeEC

int Graph::minNodeEC
private

◆ minNodeEccentricity

int Graph::minNodeEccentricity
private

◆ minNodeEVC

int Graph::minNodeEVC
private

◆ minNodeIC

int Graph::minNodeIC
private

◆ minNodeIRCC

int Graph::minNodeIRCC
private

◆ minNodeKC

int Graph::minNodeKC
private

◆ minNodePP

int Graph::minNodePP
private

◆ minNodePRP

int Graph::minNodePRP
private

◆ minNodeSBC

int Graph::minNodeSBC
private

◆ minNodeSCC

int Graph::minNodeSCC
private

◆ minNodeSDC

int Graph::minNodeSDC
private

◆ minNodeSPC

int Graph::minNodeSPC
private

◆ minNodeSSC

int Graph::minNodeSSC
private

◆ minPP

qreal Graph::minPP
private

◆ minPRP

qreal Graph::minPRP
private

◆ minSBC

qreal Graph::minSBC
private

◆ minSCC

qreal Graph::minSCC
private

◆ minSDC

qreal Graph::minSDC
private

◆ minSDP

qreal Graph::minSDP
private

◆ minSPC

qreal Graph::minSPC
private

◆ minSSC

qreal Graph::minSSC
private

◆ neighboursHash

QHash<int, QSet<int> > Graph::neighboursHash
private

◆ nomEC

qreal Graph::nomEC
private

◆ nomEVC

qreal Graph::nomEVC
private

◆ nomIC

qreal Graph::nomIC
private

◆ nomIRCC

qreal Graph::nomIRCC
private

◆ nomPP

qreal Graph::nomPP
private

◆ nomPRC

qreal Graph::nomPRC
private

◆ nomSBC

qreal Graph::nomSBC
private

◆ nomSCC

qreal Graph::nomSCC
private

◆ nomSPC

qreal Graph::nomSPC
private

◆ order

bool Graph::order
private

◆ outboundEdgesVert

int Graph::outboundEdgesVert
private

◆ reciprocalEdgesVert

int Graph::reciprocalEdgesVert
private

◆ SIGMA

Matrix Graph::SIGMA
private

◆ sumBC

qreal Graph::sumBC
private

◆ sumBPC

qreal Graph::sumBPC
private

◆ sumCC

qreal Graph::sumCC
private

◆ sumDC

qreal Graph::sumDC
private

◆ sumDP

qreal Graph::sumDP
private

◆ sumEC

qreal Graph::sumEC
private

◆ sumEVC

qreal Graph::sumEVC
private

◆ sumIC

qreal Graph::sumIC
private

◆ sumIRCC

qreal Graph::sumIRCC
private

◆ sumKC

qreal Graph::sumKC
private

◆ sumPC

qreal Graph::sumPC
private

◆ sumPP

qreal Graph::sumPP
private

◆ sumPRP

qreal Graph::sumPRP
private

◆ sumSBC

qreal Graph::sumSBC
private

◆ sumSC

qreal Graph::sumSC
private

◆ sumSCC

qreal Graph::sumSCC
private

◆ sumSDC

qreal Graph::sumSDC
private

◆ sumSDP

qreal Graph::sumSDP
private

◆ sumSEVC

qreal Graph::sumSEVC
private

◆ sumSPC

qreal Graph::sumSPC
private

◆ sumSSC

qreal Graph::sumSSC
private

◆ t_sumIC

qreal Graph::t_sumIC
private

◆ t_sumPRP

qreal Graph::t_sumPRP
private

◆ triadTypeFreqs

QList<int> Graph::triadTypeFreqs
private

◆ urlQueue

QQueue<QUrl>* Graph::urlQueue
private

◆ varianceBPC

qreal Graph::varianceBPC
private

◆ varianceCLC

qreal Graph::varianceCLC
private

◆ varianceEC

qreal Graph::varianceEC
private

◆ varianceEVC

qreal Graph::varianceEVC
private

◆ varianceIC

qreal Graph::varianceIC
private

◆ varianceIRCC

qreal Graph::varianceIRCC
private

◆ varianceKC

qreal Graph::varianceKC
private

◆ variancePP

qreal Graph::variancePP
private

◆ variancePRP

qreal Graph::variancePRP
private

◆ varianceSBC

qreal Graph::varianceSBC
private

◆ varianceSCC

qreal Graph::varianceSCC
private

◆ varianceSDC

qreal Graph::varianceSDC
private

◆ varianceSDP

qreal Graph::varianceSDP
private

◆ varianceSPC

qreal Graph::varianceSPC
private

◆ varianceSSC

qreal Graph::varianceSSC
private

◆ vpos

H_Int Graph::vpos

vpos stores the real position of each vertex inside m_graph. It starts at zero (0). We need to know the place of a vertex inside m_graph after adding or removing many vertices

◆ web_crawler

WebCrawler* Graph::web_crawler
private

◆ webcrawlerThread

QThread Graph::webcrawlerThread
private

◆ WM

Matrix Graph::WM
private

◆ XM

Matrix Graph::XM
private

◆ XRM

Matrix Graph::XRM
private

◆ XSM

Matrix Graph::XSM
private

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