![]() |
Code Documentation 3.7
Social Network Visualizer
|
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>


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< FilterSpec > | filterSpecList () 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. | |
| Graph * | subgraphExtract (const QString &name, const bool &includeCustomAttributes=true) |
| Extracts currently visible (non-filtered) nodes and their inter-edges into an independent Graph copy. | |
| Graph * | subgraphExtractFromSelection (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 ¤tUrl, const NetworkRequestType &type) |
| void | signalGraphSavedStatus (const int &status) |
| void | signalGraphModified (const bool &undirected, const int &vertices, const int &edges, const qreal &density, const bool ¬Saved=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. | |
| GraphVertex * | vertexAtIndex (int idx) |
| Returns the vertex at a given index. | |
| const GraphVertex * | vertexAtIndex (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 ¢er=0) |
| Creates a subgraph (clique, star, cycle, line) with vertices in vList Iff vList is empty, then fallbacks to the m_verticesSelected. | |
| GraphVertex * | vertexPtr (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< SelectedEdge > | getSelectedEdges () 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. | |
| Matrix & | matrixAdjacency () |
| Matrix & | matrixAdjacencyInverse () |
| Matrix & | matrixDistances () |
| Matrix & | matrixReachability () |
| Matrix & | matrixWalks () |
| Matrix & | matrixTotalWalks () |
| Matrix & | matrixCliqueCoMembership () |
| 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 °rees1, qreal °rees2) |
| 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 °ree, const double &beta, const QString &mode) |
| Creates a Watts–Strogatz small-world random network. | |
| bool | randomNetRingLatticeCreate (const int &N, const int °ree, const bool updateProgress=false) |
| Creates a random ring lattice network. | |
| bool | randomNetRegularCreate (const int &N, const int °ree, 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 | |
| Graph * | subgraphFromVertexList (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. | |
Friends | |
| class | DistanceEngine |
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.
| enum Graph::Clustering |
| enum Graph::ModStatus |
|
strong |
| Graph::Graph | ( | const int & | reserveVerticesSize = 5000, |
| const int & | reserveEdgesPerVertexSize = 500 ) |
Constructs a Graph.
| Graph::~Graph | ( | ) |
Destroys the Graph object.
| void Graph::addGeodesicsCount | ( | int | n | ) |
|
signal |
|
signal |
| 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.
| allRelations |
| void Graph::addToDistanceSum | ( | qreal | delta | ) |
|
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.
| 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.
| 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.
|
slot |
Gets the max radius of the canvas.
|
slot |
Gets the min dimensions of the canvas.
|
slot |
Returns a random x-coordinate adjusted to be visible inside the canvas usable area.
|
slot |
Returns a random y-coordinate adjusted to be visible inside the canvas usable area.
|
slot |
Sets the size of the canvas.
Called when the MW is resized to update canvasWidth/canvasHeight, and node positions
| w | |
| h |
|
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.
| width | New canvas width in pixels. |
| height | New canvas height in pixels. |
|
slot |
Checks if x is visible inside the canvas usable area and if not returns an adjusted x-coordinate.
| x |
|
slot |
Checks if y is visible inside the canvas usable area and if not returns an adjusted y-coordinate.
| y |
| 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.
| alpha | |
| beta | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| considerWeights | |
| dropIsolates |
| 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.
| considerWeights | |
| inverseWeights |
| 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).
| considerWeights | |
| inverseWeights |
| 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.
| alpha | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| void Graph::clear | ( | const QString & | reason = "" | ) |
Clears all vertices.
| reason |
| qreal Graph::clusteringCoefficient | ( | ) |
Computes local clustering coefficients and returns the network average Clustering Coefficient.
| updateProgress |
| 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.
| v1 | The vertex number whose local CLUCOF is requested. |
| 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.
| DV | |
| dist | |
| angle1 | |
| angle2 | |
| degrees1 | |
| degrees2 |
| 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).
| V | Number of active vertices in the graph. |
| void Graph::createMatrixAdjacency | ( | const bool | dropIsolates = false, |
| const bool | considerWeights = true, | ||
| const bool | inverseWeights = false, | ||
| const bool | symmetrize = false ) |
| bool Graph::createMatrixAdjacencyInverse | ( | const QString & | method = "lu" | ) |
Computes the inverse of the current adjacency matrix.
| method |
| 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.
| INPUT_MATRIX | |
| DSM | |
| metric | |
| varLocation | |
| diagonal | |
| considerWeights |
| void Graph::createMatrixReachability | ( | ) |
Creates the reachability matrix XRM.
| 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 ) |
| 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
| AM | |
| PCC | |
| rows |
|
private |
methods used by graphDistancesGeodesic()
|
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:
For a directed arc v1->v2:
For an undirected edge (EdgeType::Undirected), the edge is stored as two symmetric directed arcs:
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).
| v1 | Source node number (external node number, not internal index) |
| v2 | Target node number (external node number, not internal index) |
| weight | Edge weight |
| type | EdgeType::Directed, Undirected, or Reciprocated |
| label | Edge label (optional, stored on the out-arc of v1) |
| color | Edge color (optional, stored on the out-arc of v1) |
| 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:
| MyEdge Graph::edgeClicked | ( | ) |
Returns clicked edge.
|
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.
| v1 | |
| v2 |
| QString Graph::edgeColor | ( | const int & | v1, |
| const int & | v2 ) |
Returns the color of the directed edge v1->v2.
| v1 | |
| v2 |
| bool Graph::edgeColorAllSet | ( | const QString & | color, |
| const int & | threshold = RAND_MAX ) |
Changes the color of all enabled edges.
| color |
| void Graph::edgeColorInit | ( | const QString & | color | ) |
Saves the default edge color Used by random network creation methods.
| color |
| void Graph::edgeColorSet | ( | const int & | v1, |
| const int & | v2, | ||
| const QString & | color ) |
Changes the color of edge v1->v2.
| v1 | |
| v2 | |
| color |
| void Graph::edgeColorZeroInit | ( | const QString & | color | ) |
|
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:
Edge type semantics:
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:
| v1 | Source node number |
| v2 | Target node number |
| weight | Edge weight |
| color | Edge color |
| type | Edge type: EdgeType::Undirected, Directed, or Reciprocated |
| drawArrows | Whether to draw arrowheads in the UI |
| bezier | Whether to draw the edge as a bezier curve |
| label | Edge label (optional) |
| signalMW | Whether to signal MainWindow after modifying graph state |
|
slot |
Called from WebCrawler when it finds an new link Calls edgeCreate() method with initEdgeColor.
| source | |
| target |
| 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.
| v1 | Source vertex number. |
| v2 | Target vertex number. |
| 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.
| v1 | Source vertex number. |
| v2 | Target vertex number. |
| attrs | Key/value map of custom attributes. |
| 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)
| v1 | |
| v2 | |
| reciprocated | if true, checks if the edge is reciprocated (v1<->v2) with the same weight |
| 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
| v1 | |
| v2 |
|
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.
| cond | The filter condition (key, operator, value). |
|
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().
| query | Compound query; all conditions should have Scope::Edges. |
|
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().
| m_threshold | The weight threshold. |
| overThreshold | If true, keep edges with weight >= threshold (hide the rest); if false, keep edges with weight <= threshold. |
|
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.
|
slot |
Enables or disables unilateral edges in current relationship.
If toggle=true, all non-reciprocal edges are disabled, effectively making the network symmetric.
| toggle |
| void Graph::edgeInboundStatusSet | ( | const int & | target, |
| const int & | source, | ||
| const bool & | toggle = false ) |
Toggles the status of inbound edge target <- source at target vertex.
| v1 | |
| v2 | |
| toggle |
| QString Graph::edgeLabel | ( | const int & | v1, |
| const int & | v2 ) const |
Returns the label of edge v1->v2.
| v1 | |
| v2 |
| void Graph::edgeLabelSet | ( | const int & | v1, |
| const int & | v2, | ||
| const QString & | label ) |
Changes the label of edge v1->v2.
| v1 | |
| v2 | |
| weight |
| void Graph::edgeLabelsVisibilitySet | ( | const bool & | toggle | ) |
Toggles the visibility of edge labels.
| toggle |
| void Graph::edgeOutboundStatusSet | ( | const int & | source, |
| const int & | target, | ||
| const bool & | toggle = false ) |
Toggles the status of outbound edge source -> target at source vertex.
| v1 | |
| v2 | |
| toggle |
| 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.
| v1 | |
| v2 | |
| removeReverse | if true also removes the reverse edge |
| void Graph::edgeRemoveSelected | ( | SelectedEdge & | selectedEdge, |
| const bool & | removeReverse ) |
Removes a SelectedEdge.
| selectedEdge | |
| removeReverse |
| void Graph::edgeRemoveSelectedAll | ( | ) |
Removes all selected edges.
| int Graph::edgesEnabled | ( | ) |
Returns the number of enabled ties in the current relation.
IMPORTANT: Naming vs semantics
Caching:
TODO / THINK: Self-loops (v->v)
| bool Graph::edgeSymmetric | ( | const int & | v1, |
| const int & | v2 ) |
Returns TRUE if edge(v1, v2) is symmetric, i.e. (v1,v2) == (v2,v1).
| v1 | |
| v2 |
| 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.
| v1 | |
| v2 | |
| weight |
| qreal Graph::edgeWeight | ( | const int & | v1, |
| const int & | v2 ) const |
Returns the weight of the edge v1->v2.
| v1 | |
| v2 |
| void Graph::edgeWeightNumbersVisibilitySet | ( | const bool & | toggle | ) |
Changes the visibility of edge weight numbers.
| toggle |
| 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).
| v1 | |
| v2 | |
| weight | |
| undirected |
| 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).
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| int Graph::factorial | ( | int | x | ) |
Calculates and returns x! factorial... used in (n 2)p edges calculation
|
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.
| int Graph::getFileFormat | ( | ) | const |
Returns the format of the last file opened.
| QString Graph::getFileName | ( | ) | const |
Returns the file name of the current graph, if any.
| int Graph::getGeodesicsCount | ( | ) |
Returns the number of geodesics (shortest-paths) in the graph.
| 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"
| int Graph::getProminenceIndexByName | ( | const QString & | prominenceIndexName | ) |
Returns the IndexType of the given prominence index name Called from MW::slotEditNodeFind, MW::slotLayoutRadialByProminenceIndex etc.
| prominenceIndexName |
| QList< SelectedEdge > Graph::getSelectedEdges | ( | ) | const |
Returns a QList of user-selected edges in pair<int,int>.
| int Graph::getSelectedEdgesCount | ( | ) | const |
Returns the count of user-selected edges.
| QList< int > Graph::getSelectedVertices | ( | ) | const |
Returns a QList of user-selected vertices.
| int Graph::getSelectedVerticesCount | ( | ) | const |
Returns count of user-selected vertices.
| int Graph::getSelectedVerticesMax | ( | ) | const |
Returns max of user-selected vertices.
| int Graph::getSelectedVerticesMin | ( | ) | const |
Returns min of user-selected vertices.
| QThread * Graph::getThread | ( | ) | const |
|
slot |
Resets the clicked edge and node.
Usually, called when the user clicks on an empty space.
| p |
| 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 .
| list |
| 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
| R | Current clique under construction (vertices already chosen). |
| P | Candidate vertices that can extend R. |
| X | Excluded vertices (already processed at this level). |
| int Graph::graphCliquesContaining | ( | const int & | actor, |
| const int & | size = 0 ) |
Returns the number of maximal cliques which include a given actor
| int Graph::graphCliquesOfSize | ( | const int & | size | ) |
Graph::graphCliquesOfSize Returns the number of maximal cliques of a given size.
| size |
| 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:
| matrix | |
| metric | |
| method | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| int Graph::graphClusteringMethodStrToType | ( | const QString & | method | ) | const |
Helper method, return clustering method type from the human readable name of it.
| method |
| QString Graph::graphClusteringMethodTypeToString | ( | const int & | methodType | ) | const |
Helper method, return the human readable name of clustering method type.
| int Graph::graphConnectednessFull | ( | const bool | updateProgress = false | ) |
| 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:
| respectDirection | true 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. |
| 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:
Therefore:
TODO / THINK: Self-loops (v->v)
| int Graph::graphDiameter | ( | const bool | considerWeights, |
| const bool | inverseWeights ) |
Returns the diameter of the graph, aka the largest geodesic distance between any two vertices.
| considerWeights | |
| inverseWeights |
| int Graph::graphDiameterCached | ( | ) | const |
Returns the number of geodesics (shortest paths) in the graph, without recalculating it.
| void Graph::graphDichotomization | ( | const qreal | threshold | ) |
Creates a new binary relation in a valued network using edge dichotomization according to the threshold parameter.
| threshold |
| qreal Graph::graphDistanceEuclidean | ( | const QPointF & | a | ) |
the euclideian distance of QPointF a (where a is difference vector)
| a |
| qreal Graph::graphDistanceEuclidean | ( | const QPointF & | a, |
| const QPointF & | b ) |
Computes the euclideian distance between QPointF a and b.
| a | |
| b |
| 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.
| v1 | |
| v2 | |
| considerWeights | |
| inverseWeights |
| qreal Graph::graphDistanceGeodesicAverage | ( | const bool | considerWeights, |
| const bool | inverseWeights, | ||
| const bool | dropIsolates ) |
Returns the average distance of the graph.
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| qreal Graph::graphDistanceGeodesicAverageCached | ( | ) | const |
Returns the average geodesic distance of the graph, without recalculating it.
| 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:
| centralities | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
|
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.
| fileType | |
| fileName | |
| netName | |
| totalNodes | |
| totalLinks | |
| edgeDirType | |
| elapsedTime | |
| message |
| 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.
| considerWeights | Pass through to graphDistancesGeodesic; selects BFS vs Dijkstra. |
| inverseWeights | Pass through to graphDistancesGeodesic; inverts edge weights. |
| qreal Graph::graphGeodesicsCountCached | ( | ) | const |
Returns the number of geodesics (shortest paths) accumulated by DistanceEngine, without recalculating anything.
| 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.
| v1 | Source vertex number. |
| v2 | Target vertex number. |
| considerWeights | If true, uses Dijkstra with edge weights; otherwise BFS. |
| inverseWeights | If true, uses 1/weight as the edge cost (for closeness-style paths). |
| QStringList Graph::graphHasEdgeCustomAttributes | ( | ) | const |
Returns a list of all unique custom attribute keys present across all enabled edges in the current graph.
| QStringList Graph::graphHasVertexCustomAttributes | ( | ) | const |
Returns true if at least one vertex has a 'custom' attribute.
| bool Graph::graphHasVertexCustomIcons | ( | ) | const |
Returns true if at least one vertex has a 'custom' shape (therefore a custom icon).
|
slot |
Graph::graphLoadedTerminateParserThreads.
| reason |
| 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.
| considerWeights | If true, edge weights are used in distance computations. |
| inverseWeights | If true, edge weights are inverted before use. |
| dropIsolates | If true, isolate nodes are excluded from the analysis. |
| 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.
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| int Graph::graphMatrixStrToType | ( | const QString & | matrix | ) | const |
Helper method, return the matrix type of human readable matrix name .
| matrix |
| QString Graph::graphMatrixTypeToString | ( | const int & | matrixType | ) | const |
Helper method, return the human readable name of matrix type.
| matrix |
| int Graph::graphMetricStrToType | ( | const QString & | metricStr | ) | const |
Helper method, return the identifier of a metric.
| metricStr |
| QString Graph::graphMetricTypeToString | ( | const int & | metricType | ) | const |
Helper method, return the human readable name of metric type.
| metric |
| 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.
| source | |
| target | |
| respectDirection | true 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. |
| bool Graph::graphReachable | ( | const int & | v1, |
| const int & | v2 ) |
Returns true if vertices v1 and v2 are reachable.
| v1 | |
| v2 |
| qreal Graph::graphReciprocity | ( | ) |
Gets the arc reciprocity of the graph.
Also computes the dyad reciprocity and fills parameters with values.
| 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.
| int Graph::graphStronglyConnectedComponentsCached | ( | ) | const |
| qreal Graph::graphSumDistanceCached | ( | ) | const |
Returns the sum of all finite geodesic distances accumulated by DistanceEngine, without recalculating anything.
| 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.
|
inline |
| 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.
| 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. |
| int Graph::graphWeaklyConnectedComponents | ( | ) |
Counts weakly connected components using BFS.
Weak connectivity treats every edge as undirected regardless of graph type:
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.
| int Graph::graphWeaklyConnectedComponentsCached | ( | ) | const |
|
inline |
|
slot |
Helper method, returns a nice qstring where all html special chars are encoded.
| str |
| void Graph::incGeodesicsCount | ( | ) |
| 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.
| bool Graph::isCentralityIndexComputed | ( | const IndexType | index | ) | const |
| 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.
| bool Graph::isConnectedCached | ( | ) | const |
Returns true if the graph is connected, without recalculating it.
| bool Graph::isDirected | ( | ) |
Returns true if graph is directed.
| bool Graph::isEmpty | ( | ) | const |
Returns true if the current graph has no vertices at all.
| bool Graph::isFileFormatExportSupported | ( | const int & | fileFormat | ) | const |
Returns true if the fileFormat is supported for saving.
| fileFormat |
| bool Graph::isLoaded | ( | ) | const |
Returns true if a graph has been loaded from a file.
| bool Graph::isModified | ( | ) | const |
Returns true of graph is modified (edges/vertices added/removed).
| bool Graph::isSaved | ( | ) | const |
Returns true if the graph is saved.
| bool Graph::isSymmetric | ( | ) |
Returns TRUE if the adjacency matrix of the current relation is symmetric.
| bool Graph::isUndirected | ( | ) |
Returns true if graph is undirected.
| 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 (
When you need to know whether any relation is weighted, use
Complexity: O(n²) on cache miss, O(1) on hit.
| 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).
| prominenceIndex,0-12 | |
| layoutType | 0,1,2,3 |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| x0 | |
| y0 | |
| maxRadius |
| 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.
| egoVertex | The vertex number to place at the center. |
| 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.
| c4 | Displacement 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. |
| 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).
| model | Layout model identifier: "Eades" or "FR". |
| dist | Euclidean distance between the two adjacent vertices (canvas pixels). |
| optimalDistance | The natural/optimal inter-vertex spacing for the current graph. |
| 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.
For the FR model: uses the grid-variant with a 2*optimalDistance cutoff radius, as described by Fruchterman & Reingold (1991).
| model | Layout model identifier: "Eades" or "FR". |
| dist | Euclidean distance between the two vertices (canvas pixels). |
| optimalDistance | The natural/optimal inter-vertex spacing for the current graph. |
| 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.
| temperature | Current annealing temperature, controlling the maximum displacement per iteration. Computed by layoutForceDirected_FR_temperature(). |
| qreal Graph::layoutForceDirected_FR_temperature | ( | const int | iteration | ) | const |
Reduces the temperature as the layout approaches a better configuration.
| 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.
| maxIterations |
| 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.
| void Graph::layoutForceDirectedSpringEmbedder | ( | const int | maxIterations | ) |
Embeds a Force Directed Placement layout according to the initial Spring Embedder model proposed by Eades.
| maxIterations | Maximum 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:
| void Graph::layoutRadialRandom | ( | const bool & | guides = true | ) |
Repositions all nodes on the periphery of different circles with random radius.
| x0 | |
| y0 | |
| maxRadius |
| void Graph::layoutRandom | ( | ) |
Repositions all nodes on random positions Emits setNodePos(i, x,y) to tell GW that the node item should be moved.
| maxWidth | |
| maxHeight |
|
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.
| void Graph::layoutVertexSizeByIndegree | ( | ) |
Convenience method Changes the size of all nodes to be proportional to their InDegree (Degree Prestige) Calls layoutByProminenceIndex.
| void Graph::layoutVertexSizeByOutdegree | ( | ) |
Convenience method Changes the size of all nodes to be proportional to their outDegree (Degree Centrality) Calls layoutByProminenceIndex.
| 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.
| fileName | |
| codecName | |
| m_showLabels | |
| maxWidth | |
| maxHeight | |
| fileFormat | |
| sm_two_mode |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
Computes minimum and maximum centralities during graphDistancesGeodesic().
| C | |
| v | |
| max | |
| min | |
| maxNode | |
| minNode |
| void Graph::moveToThreadFacade | ( | QThread * | thread | ) |
| void Graph::notConnectedPairsClear | ( | ) |
| void Graph::notConnectedPairsInsert | ( | int | from, |
| int | to ) |
| int Graph::notConnectedPairsSize | ( | ) | const |
| 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.
| 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.
| 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.
| 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
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).
| weights | |
| dropIsolates |
| 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.
| dropIsolates |
| 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.
| bool Graph::progressCanceled | ( | ) | const |
Returns true if the user has requested cancellation via the progress dialog.
|
protected |
Emits a status message to be shown in the UI status bar.
| msg | The message to be shown. |
| 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.
| index | |
| type |
| 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:
discreteClasses 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.
| discreteClasses | Map of value (string) -> frequency. |
| name | Display name of the series. |
| distImageFileName | If non-empty, export chart to this PNG file. |
| 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:
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.
| discreteClasses | A map of centrality value (as string) to frequency. |
| name | The display name of the distribution series. |
| distImageFileName | If non-empty, the chart is exported to this PNG file. |
| 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:
discreteClasses 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.
| discreteClasses | Map of value (string) -> frequency. |
| seriesName | Display name of the series. |
| distImageFileName | If non-empty, export chart to this PNG file. |
| void Graph::randomizeThings | ( | ) |
Adds a little universal randomness :).
RANDOM NETWORKS
| 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:
| N | Number of nodes. |
| model | "G(n,p)" or "G(n,M)". |
| m | Number of edges (used in G(n,M) model; 0 for G(n,p)). |
| p | Edge probability (used in G(n,p) model; 0 for G(n,M)). |
| mode | "graph" for undirected, anything else for directed. |
| diag | If true, self-loops are allowed. |
| 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.
| N | Total number of nodes (should equal length^2). |
| length | Number of nodes along each dimension of the grid. |
| dimension | Reserved for future use (higher-dimensional lattices). |
| neighborhoodLength | Distance within which nodes are connected. |
| mode | "graph" for undirected, anything else for directed. |
| circular | Reserved for future use (toroidal/circular lattice). |
| 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:
| N | Number of nodes. |
| degree | Desired degree of every node (must be even for undirected). |
| mode | "graph" for undirected, anything else for directed. |
| diag | Reserved, currently unused. |
| bool Graph::randomNetRingLatticeCreate | ( | const int & | N, |
| const int & | degree, | ||
| const bool | updateProgress = false ) |
Creates a random ring lattice network.
| vert | |
| degree | |
| x0 | |
| y0 | |
| radius | |
| updateProgress |
| 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:
The attachment probability for node j is: P(j) = (alpha + degree(j)^power) / sumDegrees
| N | Total number of nodes in the final network. |
| power | Exponent of the preferential attachment (typically 1). |
| m0 | Number of nodes in the initial seed clique. |
| m | Number of edges each new node attaches to existing nodes. |
| alpha | Additive constant in the attachment probability (zero-appeal). |
| mode | "graph" for undirected, anything else for directed. |
| 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:
| N | Number of nodes. |
| degree | Number of neighbours each node is initially connected to (must be even). |
| beta | Rewiring probability in [0,1]. 0 = pure lattice, 1 = random graph. |
| mode | "graph" for undirected, anything else for directed. |
| void Graph::relationAdd | ( | const QString & | relName, |
| const bool & | changeRelation = false ) |
| 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.
|
slot |
Gets the current relation number.
|
slot |
Gets the current relation name.
|
slot |
Overload. Renames current relation to newName, without emitting any signal to MW.
| newName |
|
slot |
Renames current relation to newName, optionally emitting a signal to MW.
| newName |
|
slot |
Changes graph to next relation.
|
slot |
Changes graph to previous relation.
| int Graph::relations | ( | ) |
Returns the count of relationships in this Graph.
| void Graph::relationsClear | ( | ) |
Clears relationships in this Graph.
|
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.
| relNum | int |
| updateUI | bool |
| void Graph::resetDistanceAggregates | ( | ) |
| void Graph::resetDistanceCentralityCacheFlags | ( | ) |
| void Graph::resetProgressCanceled | ( | ) |
Resets the cancellation status.
|
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().
| C | |
| discreteClasses | |
| classes |
|
private |
Overloaded method. It only adds displaying current vertex for debugging purposes.
| C | |
| discreteClasses | |
| classes | |
| vertex |
|
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.
| fn | The work to run on the main/GUI thread. |
| bool Graph::saveToAdjacencyFormat | ( | const QString & | fileName, |
| const bool & | saveEdgeWeights = true ) |
Saves the active graph to an adjacency-formatted file.
| fileName |
| 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.
| fileName | Destination file path. |
| 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.
| fileName | Destination file path. |
| 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.
| fileName | Destination file path. |
| 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
| fileName | |
| fileType |
| 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.
| fileName | |
| networkName | |
| maxWidth | |
| maxHeight |
| bool Graph::saveToPajekFormat | ( | const QString & | fileName, |
| QString | networkName = "", | ||
| int | maxWidth = 0, | ||
| int | maxHeight = 0 ) |
Save the current graph to a Pajek (.paj) file.
Writes:
Relation header export (multi-relation):
Notes:
| fileName | Output file path (should end in .paj). |
| networkName | Optional exported network name. If empty, uses graph name. If "unnamed", derives from file name without extension. |
| maxWidth | Canvas width used to normalize X coordinates (0 => use current). |
| maxHeight | Canvas height used to normalize Y coordinates (0 => use current). |
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:
Relation labels are normalized before export:
IMPORT remains tolerant. EXPORT remains canonical.
| 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).
| fileName | Destination file path. |
| void Graph::setAverageDistanceCached | ( | qreal | v | ) |
| void Graph::setConnectedCached | ( | bool | v | ) |
| void Graph::setDiameterCached | ( | int | v | ) |
| void Graph::setDirected | ( | const bool & | toggle = true, |
| const bool & | signalMW = true ) |
Toggles the graph directed or undirected.
| toggle | |
| signalMW |
|
signal |
|
signal |
|
signal |
| void Graph::setFileFormat | ( | const int & | fileFormat | ) |
| void Graph::setFileName | ( | const QString & | fileName | ) |
Sets the file name of the current graph.
| fileName |
| 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.
| int | graphNewStatus |
| bool | signalMW |
| void Graph::setName | ( | const QString & | graphName | ) |
Sets the name of the current graph.
| graphName |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
| void Graph::setReportsChartType | ( | const int & | type | ) |
Sets the chart type in reports.
| type |
| 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.
| dir |
| void Graph::setReportsLabelLength | ( | const int & | length | ) |
Sets the length of labels in reports.
| length |
| void Graph::setReportsOutputFormat | ( | const int & | format | ) |
Sets the output format (HTML or CSV) new reports are written in.
| format |
| void Graph::setReportsRealNumberPrecision | ( | const int & | precision | ) |
Sets the precision (number of fraction digits) the app will use when writing real numbers in reports.
| precision |
|
slot |
Sets the user-selected vertices and edges.
Usually called from GW, it emits selection counts to MW
| selectedVertices | |
| selectedEdges |
| void Graph::setSymmetric | ( | ) |
Transforms the graph to symmetric (all edges reciprocal).
| void Graph::setSymmetricCached | ( | bool | v | ) |
| void Graph::setUndirected | ( | const bool & | toggle = true, |
| const bool & | signalMW = true ) |
Makes the graph undirected or directed.
| toggle | |
| signalMW |
|
signal |
| void Graph::setWeighted | ( | const bool & | toggle = true | ) |
Sets the graph to be weighted ( valued edges ).
| toggle |
| void Graph::showZeroWeightEdgesSet | ( | const bool & | toggle | ) |
| int Graph::sign | ( | const qreal & | D | ) |
|
signal |
|
signal |
|
signal |
Signals to GraphicsWidget
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
Signals to MainWindow
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
signal |
|
slot |
Slot called by MainWindow when the user clicks Cancel in the progress dialog.
|
slot |
Gets the reply of a MW network request made by Web Crawler, and emits that reply as is to the Web Crawler.
|
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.
| startUrl | |
| urlPatternsIncluded | |
| urlPatternsExcluded | |
| linkClasses | |
| maxNodes | |
| maxLinksPerPage | |
| intLinks | |
| childLinks | |
| parentLinks | |
| selfLinks | |
| extLinksIncluded | |
| extLinksCrawl | |
| socialLinks | |
| delayedRequests |
|
signal |
|
slot |
Extracts currently visible (non-filtered) nodes and their inter-edges into an independent Graph copy.
Collects all enabled vertices, then delegates to subgraphFromVertexList().
| name | Name assigned to the new graph. |
| includeCustomAttributes | When true, node and edge custom attribute maps are copied verbatim. |
|
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.
| name | Name assigned to the new graph. |
| includeCustomAttributes | When true, node and edge custom attribute maps are copied verbatim. |
|
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.
| vertexNums | Source vertex numbers to include. |
| name | Name assigned to the new graph. |
| includeCustomAttributes | When true, node and edge custom attribute maps are copied verbatim. |
vertexNums is empty. | bool Graph::symmetricCached | ( | ) | const |
| 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
|
protected |
|
protected |
|
protected |
| GraphVertex * Graph::vertexAtIndex | ( | int | idx | ) |
Returns the vertex at a given index.
| idx |
| const GraphVertex * Graph::vertexAtIndex | ( | int | idx | ) | const |
Returns the vertex at a given index.
| idx |
| 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):
| int Graph::vertexClicked | ( | ) | const |
Returns the number of the clicked vertex.
|
slot |
Sets the clicked vertex.
Signals to MW to show node info on the status bar.
| v1 | |
| p |
| QColor Graph::vertexColor | ( | const int & | v1 | ) | const |
| void Graph::vertexColorInit | ( | const QString & | color | ) |
Graph::vertexColorInit default vertex color initialization.
| color |
| void Graph::vertexColorSet | ( | const int & | v1, |
| const QString & | color ) |
Changes the color of vertex v1.
| v1 | |
| color |
|
inline |
|
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.
| num | |
| size | |
| nodeColor | |
| numColor | |
| numSize | |
| label | |
| lColor | |
| lSize | |
| p | |
| nodeShape | |
| signalMW |
|
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.
| QPointF | The clicked pos of the new node. |
|
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.
| bool |
|
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.
| i | |
| label | |
| signalMW |
| 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.
| v1 | Vertex number. |
| key | Attribute key to remove. |
| 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.
| v1 | The index of the vertex whose custom attributes are to be accessed. |
| 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.
| v1 | Vertex number. |
| key | Attribute key. |
| value | Attribute value. |
| 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.
| v1 | The index of the vertex for which custom attributes are being set. |
| customAttributes | A QHash containing the custom attributes to be set for the vertex. The keys and values of the QHash are both QStrings. |
| int Graph::vertexDegreeIn | ( | int | v1 | ) |
Returns the inDegree (sum of inbound edge weights) of vertex v1.
| v1 |
| int Graph::vertexDegreeOut | ( | int | v1 | ) |
Returns the outDegree (sum of outbound edge weights) of vertex v1.
| v1 |
| int Graph::vertexEdgesInbound | ( | int | v1 | ) |
Returns the number of inbound edges (arcs) to vertex v1.
| v1 |
| int Graph::vertexEdgesOutbound | ( | int | v1 | ) |
Returns the number of outbound edges (arcs) from vertex v1.
| v1 |
| bool Graph::vertexExists | ( | const int & | v1 | ) |
Checks if the given vertex exists in the graph.
| vertex | number |
| bool Graph::vertexExists | ( | const QString & | label | ) |
Checks if there is a vertex with a specific label in the graph.
| label |
|
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.
| cond | The filter condition (key, operator, value). |
|
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:
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.
|
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.
| v1 | The ego vertex (center of the neighborhood). |
| depth | Neighborhood depth (currently only depth=1 supported). |
|
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.
| query | Compound query; all conditions should have Scope::Nodes. |
|
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.
| selectedVertices | List of vertex numbers that should remain visible. |
|
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.
|
private |
Re-applies one filter from its stored replay parameters.
Used by vertexFilterRemoveAt() during stack reconstruction.
|
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.
| 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.
| QStringList |
| bool Graph::vertexFindByLabel | ( | const QStringList & | labelList | ) |
Finds vertices by their label.
| QStringList |
| bool Graph::vertexFindByNumber | ( | const QStringList & | numList | ) |
Finds vertices in strList by their number.
| QStringList |
| 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
| vertex | number |
| 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
| vertex | number |
| int Graph::vertexIndexIfExists | ( | const QString & | label | ) |
Returns the internal position of the vertex with the given label, if it exists.
Complexity: O(N)
| label |
| bool Graph::vertexIsolated | ( | const int & | v1 | ) | const |
Checks if vertex is isolated.
| v1 |
|
slot |
Toggles the status of all isolated vertices (those without links).
For each isolate vertex in the Graph, emits the setVertexVisibility signal
| toggle |
| QString Graph::vertexLabel | ( | const int & | v | ) | const |
Returns the label of a vertex v1.
| v1 |
| void Graph::vertexLabelColorInit | ( | QString | color | ) |
Graph::vertexLabelColorInit Changes the default vertex label color.
| color |
| void Graph::vertexLabelColorSet | ( | const int & | v1, |
| const QString & | color ) |
Changes the label color of vertex v1 or all vertices if v1 = 0.
| v1 | |
| color |
| void Graph::vertexLabelDistanceAllSet | ( | const int & | newDistance | ) |
Changes the distance of all vertex labels from their vertices.
| size |
| void Graph::vertexLabelDistanceInit | ( | const int & | distance | ) |
Changes the default distance of vertex labels.
| distance |
| void Graph::vertexLabelDistanceSet | ( | const int & | v, |
| const int & | newDistance ) |
Changes the distance.of vertex v label from the vertex.
| v | |
| size |
| void Graph::vertexLabelSet | ( | const int & | v1, |
| const QString & | label ) |
Changes the label of a vertex v1.
| v1 | |
| label |
| void Graph::vertexLabelSizeInit | ( | int | newSize | ) |
Graph::vertexLabelSizeInit Changes the default size of vertex labels.
| newSize |
| void Graph::vertexLabelSizeSet | ( | const int & | v1, |
| const int & | labelSize ) |
Changes the label size of vertex v1 or all vertices if v1=0.
| v1 | |
| size |
| void Graph::vertexLabelsVisibilitySet | ( | bool | toggle | ) |
| void Graph::vertexNumberColorInit | ( | const QString & | color | ) |
Changes the initial color of the vertex numbers.
| color |
| void Graph::vertexNumberColorSet | ( | const int & | v1 = 0, |
| const QString & | color = "#000000" ) |
Graph::vertexColorSet Changes the color of vertex v1.
| v1 | |
| color |
| void Graph::vertexNumberDistanceInit | ( | const int & | distance | ) |
Changes the initial distance of vertex numbers.
| distance |
| void Graph::vertexNumberDistanceSet | ( | const int & | v, |
| const int & | newDistance ) |
Changes the distance.of vertex v number from the vertex.
| v | |
| size |
| int Graph::vertexNumberMax | ( | ) |
Returns the number of the last vertex in the graph.
| int Graph::vertexNumberMin | ( | ) |
Returns the number of the first vertex in the graph.
| void Graph::vertexNumberSizeInit | ( | const int & | size | ) |
Changes the initial size of vertex numbers.
| size |
| void Graph::vertexNumberSizeSet | ( | const int & | v, |
| const int & | size ) |
Changes the size of vertex v number.
| v | |
| size |
| 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.
| v1 | The vertex number to query. |
| includeInEdges | If true, union of out- and in-neighbors is returned. Default: false (out-neighbors only). |
| QPointF Graph::vertexPos | ( | const int & | v1 | ) | const |
Returns the position of the given vertex.
| v1 |
| 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
| v1 | |
| x | |
| y |
| GraphVertex * Graph::vertexPtr | ( | const int | v | ) |
| 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.
| v1 | The vertex number to query. |
| 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.
| v1 | The vertex number to query. |
| 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.
| int | v1 |
|
slot |
Deletes a dummy node.
This is called from Parser (as pajek) to delete any redundant (dummy) nodes.
| int | i number of node |
| QString Graph::vertexShape | ( | const int & | v1 | ) |
Returns the shape of this vertex.
| v1 |
| QString Graph::vertexShapeIconPath | ( | const int & | v1 | ) |
Returns the IconPath of vertex v1.
| v1 |
| 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.
| v1 | |
| shape | |
| iconPath |
| void Graph::vertexShapeSetDefault | ( | const QString | shape, |
| const QString & | iconPath = QString() ) |
Sets the default vertex shape and iconPath.
| shape | |
| iconPath |
| int Graph::vertexSize | ( | const int & | v | ) | const |
Returns the size of vertex v.
| v |
| void Graph::vertexSizeInit | ( | const int | size | ) |
Sets the initial vertex size.
| size |
| 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)
| v | |
| size |
| 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).
| dropIsolates | |
| countAll |
| VList::const_iterator Graph::verticesBegin | ( | ) | const |
iterator helpers
| 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.
| vList |
| VList::const_iterator Graph::verticesEnd | ( | ) | const |
| QList< int > Graph::verticesList | ( | ) |
Returns a list of all vertices numbers inside the graph.
| QList< int > Graph::verticesListIsolated | ( | ) |
Returns a list of all isolated vertices inside the graph.
| QSet< int > Graph::verticesSet | ( | ) |
Returns a QSet of all vertices numbers inside the graph.
| int Graph::verticesWithInboundEdges | ( | ) |
Returns the sum of vertices having edgesInbound.
| int Graph::verticesWithOutboundEdges | ( | ) |
Returns the sum of vertices having edgesOutbound.
| int Graph::verticesWithReciprocalEdges | ( | ) |
Returns the sum of vertices having reciprocal edges.
|
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.
| int Graph::walksBetween | ( | int | v1, |
| int | v2, | ||
| int | length ) |
Calculates and returns the number of walks of a given length between v1 and v2.
| v1 | |
| v2 | |
| length |
| void Graph::webCrawlTerminateThreads | ( | QString | reason | ) |
called from Graph, when closing network, to terminate all crawler processes Also called indirectly when wc_spider finishes
| reason |
|
slot |
A loop, that takes urls awaiting in front of the urlQueue, and signals to the MW to make the network request.
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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 ) |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| bool Graph::writeCentralityDegree | ( | const QString | fileName, |
| const bool | considerWeights, | ||
| const bool | dropIsolates, | ||
| const int & | format = ReportFormat::Html ) |
Writes the Degree Centrality to a file.
| fileName | |
| considerWeights | |
| dropIsolates |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| bool Graph::writeCentralityInformation | ( | const QString | fileName, |
| const bool | considerWeights, | ||
| const bool | inverseWeights, | ||
| const int & | format = ReportFormat::Html ) |
Writes the information centralities to file.
| fileName | |
| considerWeights | |
| inverseWeights |
| 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.
| fileName | |
| alpha | |
| considerWeights | |
| inverseWeights | |
| dropIsolates | |
| format |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| 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
| bool Graph::writeClusteringCoefficient | ( | const QString | fileName, |
| const bool | considerWeights, | ||
| const int & | format = ReportFormat::Html ) |
Writes the clustering coefficients to a file.
| fileName | |
| considerWeights |
| 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:
| fileName | Path to the output HTML report file. |
| varLocation | Whether variables are in rows or columns ("rows"/"cols"). |
| matrix | Input matrix type: "adjacency" or "distances". |
| metric | Distance/dissimilarity metric (e.g., "euclidean", "manhattan"). |
| method | Clustering linkage method (e.g., "single", "complete", "average"). |
| diagonal | If true, include the diagonal of the matrix in computations. |
| dendrogram | If true, include dendrogram output in the report. |
| considerWeights | If true, edge weights are used in distance computations. |
| inverseWeights | If true, edge weights are inverted before use. |
| dropIsolates | If true, isolate nodes are excluded from the analysis. |
| 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...
| outText | |
| N | |
| dendrogram |
| 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
| fileName |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| 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.
| fileName | Full path of the output HTML file. |
| considerWeights | Passed through to graphGeodesicDistanceDistribution(). |
| inverseWeights | Passed through to graphGeodesicDistanceDistribution(). |
| 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).
| fn | Path to the output HTML report file. |
| matrix | Matrix type constant (e.g., MATRIX_ADJACENCY, MATRIX_DISTANCES). |
| considerWeights | If true, edge weights are used in distance computations. |
| inverseWeights | If true, edge weights are inverted before use. |
| dropIsolates | If true, isolate nodes are excluded from the analysis. |
| varLocation | Whether variables are in rows or columns ("rows"/"cols"), used for tie-profile distance matrices. |
| simpler | Reserved for future use. |
| 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
| 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.
| fn | |
| simpler |
| void Graph::writeMatrixAdjacencyTo | ( | QTextStream & | os, |
| const bool & | saveEdgeWeights = true ) |
Exports the adjacency matrix to a given textstream
| 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).
| outText | |
| M | |
| printInfinity | |
| dropIsolates |
| 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.
| fileName | |
| measure | |
| varLocation | |
| diagonal | |
| considerWeights |
| 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
| outText | |
| M | |
| markDiag | |
| plain | |
| printInfinity |
| 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.
| fileName | |
| measure | |
| matrix | |
| varLocation | |
| diagonal | |
| considerWeights |
| 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.
| fileName | |
| considerWeights |
| 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.
| fn | |
| length | |
| simpler |
| 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.
| fileName | |
| considerWeights | |
| dropIsolates |
| bool Graph::writePrestigePageRank | ( | const QString | fileName, |
| const bool | dropIsolates = false, | ||
| const int & | format = ReportFormat::Html ) |
Writes the PageRank scores of vertices to a file.
| fileName | |
| dropIsolates |
| 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.
| fileName | |
| considerWeights | |
| inverseWeights | |
| dropIsolates |
| bool Graph::writeReciprocity | ( | const QString | fileName, |
| const bool | considerWeights = false, | ||
| const int & | format = ReportFormat::Html ) |
Writes reciprocity report to filename.
| fileName | |
| considerWeights |
| 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).
| outText | |
| dataColumnHeaders | |
| rowValues | |
| isBlanked | |
| isSkipped |
| 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.
| outText | |
| dataColumnHeaders | |
| rowValues | |
| isBlanked |
| bool Graph::writeTriadCensus | ( | const QString | fileName, |
| const bool | considerWeights, | ||
| const int & | format = ReportFormat::Html ) |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
used in resolveClasses and graphDistancesGeodesic()
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
General & initialisation variables
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
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.
|
private |
|
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".
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
| 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
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |