raphtory.algorithms
Algorithmic functions that can be run on Raphtory graphs
Members
Reciprocity - measure of the symmetry of relationships in a graph. |
|
The average degree of all vertices in the graph. |
|
Graph density - measures how dense or sparse a graph is. |
|
Computes the global clustering coefficient of a graph. |
|
Reciprocity - measure of the symmetry of relationships in a graph, the global reciprocity of the entire graph. |
|
Local Clustering coefficient - measures the degree to which nodes in a graph tend to cluster together. |
|
Local triangle count - calculates the number of triangles (a cycle of length 3) for a node. |
|
The maximum in degree of any vertex in the graph. |
|
The maximum out degree of any vertex in the graph. |
|
The minimum in degree of any vertex in the graph. |
|
The minimum out degree of any vertex in the graph. |
|
Computes the number of both open and closed triplets within a graph |
|
- raphtory.algorithms.all_local_reciprocity(g)
Reciprocity - measure of the symmetry of relationships in a graph. the reciprocity of every vertex in the graph as a tuple of vector id and the reciprocity This calculates the number of reciprocal connections (edges that go in both directions) in a graph and normalizes it by the total number of edges.
In a social network context, reciprocity measures the likelihood that if person A is linked to person B, then person B is linked to person A. This algorithm can be used to determine the level of symmetry or balance in a social network. It can also reveal the power dynamics in a group or community. For example, if one person has many connections that are not reciprocated, it could indicate that this person has more power or influence in the network than others.
In a business context, reciprocity can be used to study customer behavior. For instance, in a transactional network, if a customer tends to make a purchase from a seller and then the seller makes a purchase from the same customer, it can indicate a strong reciprocal relationship between them. On the other hand, if the seller does not make a purchase from the same customer, it could imply a less reciprocal or more one-sided relationship.
- raphtory.algorithms.average_degree(g)
The average degree of all vertices in the graph.
- raphtory.algorithms.directed_graph_density(g)
Graph density - measures how dense or sparse a graph is.
It is defined as the ratio of the number of edges in the graph to the total number of possible edges. A dense graph has a high edge-to-vertex ratio, while a sparse graph has a low edge-to-vertex ratio.
For example in social network analysis, a dense graph may indicate a highly interconnected community, while a sparse graph may indicate more isolated individuals.
- raphtory.algorithms.generic_taint(g, iter_count, start_time, infected_nodes, stop_nodes)
- raphtory.algorithms.global_clustering_coefficient(g)
Computes the global clustering coefficient of a graph. The global clustering coefficient is defined as the number of triangles in the graph divided by the number of triplets in the graph.
- raphtory.algorithms.global_reciprocity(g)
Reciprocity - measure of the symmetry of relationships in a graph, the global reciprocity of the entire graph. This calculates the number of reciprocal connections (edges that go in both directions) in a graph and normalizes it by the total number of edges.
In a social network context, reciprocity measures the likelihood that if person A is linked to person B, then person B is linked to person A. This algorithm can be used to determine the level of symmetry or balance in a social network. It can also reveal the power dynamics in a group or community. For example, if one person has many connections that are not reciprocated, it could indicate that this person has more power or influence in the network than others.
In a business context, reciprocity can be used to study customer behavior. For instance, in a transactional network, if a customer tends to make a purchase from a seller and then the seller makes a purchase from the same customer, it can indicate a strong reciprocal relationship between them. On the other hand, if the seller does not make a purchase from the same customer, it could imply a less reciprocal or more one-sided relationship.
- raphtory.algorithms.local_clustering_coefficient(g, v)
Local Clustering coefficient - measures the degree to which nodes in a graph tend to cluster together.
It is calculated by dividing the number of triangles (sets of three nodes that are all connected to each other) in the graph by the total number of possible triangles. The resulting value is a number between 0 and 1 that represents the density of clustering in the graph.
A high clustering coefficient indicates that nodes tend to be connected to nodes that are themselves connected to each other, while a low clustering coefficient indicates that nodes tend to be connected to nodes that are not connected to each other.
In a social network of a particular community, we can compute the clustering coefficient of each node to get an idea of how strongly connected and cohesive that node’s neighborhood is.
A high clustering coefficient for a node in a social network indicates that the node’s neighbors tend to be strongly connected with each other, forming a tightly-knit group or community. In contrast, a low clustering coefficient for a node indicates that its neighbors are relatively less connected with each other, suggesting a more fragmented or diverse community.
- raphtory.algorithms.local_triangle_count(g, v)
Local triangle count - calculates the number of triangles (a cycle of length 3) for a node. It measures the local clustering of a graph.
This is useful for understanding the level of connectivity and the likelihood of information or influence spreading through a network.
For example, in a social network, the local triangle count of a user’s profile can reveal the number of mutual friends they have and the level of interconnectivity between those friends. A high local triangle count for a user indicates that they are part of a tightly-knit group of people, which can be useful for targeted advertising or identifying key influencers within a network.
Local triangle count can also be used in other domains such as biology, where it can be used to analyze protein interaction networks, or in transportation networks, where it can be used to identify critical junctions or potential traffic bottlenecks.
- raphtory.algorithms.max_in_degree(g)
The maximum in degree of any vertex in the graph.
- raphtory.algorithms.max_out_degree(g)
The maximum out degree of any vertex in the graph.
- raphtory.algorithms.min_in_degree(g)
The minimum in degree of any vertex in the graph.
- raphtory.algorithms.min_out_degree(g)
The minimum out degree of any vertex in the graph.
- raphtory.algorithms.pagerank(g, iter_count, max_diff=Ellipsis)
- raphtory.algorithms.triplet_count(g)
Computes the number of both open and closed triplets within a graph
An open triplet, is one where a node has two neighbors, but no edge between them. A closed triplet is one where a node has two neighbors, and an edge between them.
- raphtory.algorithms.weakly_connected_components(g, iter_count)