You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@age.apache.org by "Munmud (via GitHub)" <gi...@apache.org> on 2023/05/26 05:21:42 UTC

[GitHub] [age] Munmud commented on issue #935: Setting custom number of edges in create_complete_graph()

Munmud commented on issue #935:
URL: https://github.com/apache/age/issues/935#issuecomment-1563825398

   create_complete_graph() do this as follow
   ## What Completes Graph do
   A complete graph is a type of graph in graph theory where every pair of distinct vertices is connected by a unique edge. In other words, in a complete graph, each vertex is directly connected to every other vertex in the graph.
   
   A complete graph with n vertices is denoted as Kn, where "K" stands for complete and "n" represents the number of vertices. The total number of edges in a complete graph with n vertices can be calculated using the formula:
   
   E = n(n-1)/2
   
   In a complete graph, there are no isolated vertices since each vertex is connected to all other vertices. The degree of each vertex in a complete graph is (n-1) since each vertex is connected to all other (n-1) vertices.
   
   Complete graphs have several interesting properties and applications in graph theory and related fields. They are used as a benchmark for studying and comparing properties and algorithms in graph theory. Complete graphs also find applications in network topology, communication networks, and social network analysis, among others.
   
   ## How I Generate specific number of edges using python
   I used to work with the Age python driver and I use the following way to generate edges
   ```py
   import random
   number_of_nodes = 4000
   number_of_edges = 8000
   
   for i in range(number_of_nodes):
       # add node here using i as id property
       pass
   
   for i in range(number_of_edges):
       a = 0
       b = 0
       while(a==b):
           a = random.randint(0, number_of_nodes-1)
           b = random.randint(0, number_of_nodes-1)
       # add edge here using a and b to find specific node id
       pass
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@age.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org