Scythor

30 Reputation

One Badge

5 years, 65 days

MaplePrimes Activity


These are questions asked by Scythor

I have a graph with 267 nodes and 727 edges. I am trying to produce an eligible visualization of my graph but I'm getting a very crowded network. 

Code:

with(GraphTheory);
DrawGraph(Graph(M1), style = spring, symbolsize = 10, scaling = unconstrained); 

I have attatched the a JPEG file to my question to show what it looks like. I would like to space out the nodes with a more zoomed out view. How would I go about this?
 

I would like to analyse the graph I made and I cannot seem to find any command that gives me the average path length of an unweighted graph, is it perhaps referred as a different command? As I have tried searching Mean path length, distance and other derivatives with no useful result.

How does maple produce a Betweeness centrality matrix for unweighted, strongly connected graphs?

I am providing analysis for a Graph I have made using the GraphTheory kit. I am attempting to find a way to find the Betweeness Centrality. So far I have only found one example of the code which is being used to find the Betweeness Centrality of a Network found in a pdf (Attatched below). I have been able to alter the code accordingly to my data but the last line requires some further understanding of how Matrices work in Maple. This is the line I fail to understand completely:

"""""""" BetweenessCentrality_data := < node_data[1.., 1] | < seq(add (ad_mat[i, j] * wt_mat[i, j], j = 1.. num_characters), i = 1. . num_characters)> >: BetweenessCentrality_sorted := FlipDimension( x[2])))>, 1)  """"""""

And this is all the code leading up to the line in question:

"""""""" data := FileTools:-JoinPath(["Excel", "Inter station database (2).xls"], base = datadir);

M := ExcelTools:-Import(data, "Hoja2");

edge_data := Matrix(727, 3, (i, j) --> M[i, j+2] );

with(ListTools);

node_data := Matrix(727, 2, (i, j) -->M[i, j+2] );

convert(Matrix(<<node_data>>), list);


listednode_data := convert(Matrix(<<node_data>>), list);

MakeUnique(listednode_data);

UniqueListedNode_data := MakeUnique(listednode_data);

node_data := Matrix(numelems(UniqueListedNode_data), 1, (i, j) -->UniqueListedNode_data[i]);
 

num_edges := RowDimension(edge_data);
 

num_characters := RowDimension(node_data);
 

G := Graph(node_data[() .. (), 1], weighted);
 

for i from 1 to num_edges do

AddEdge(G, [{edge_data[i, 1], edge_data[i, 2]}, edge_data[i, 3]])

end do;

wt_mat := WeightMatrix(G);
ad_mat := AdjacencyMatrix(G); """"""""

To provide further context, my graph is strongly connected.

If anyone could kindly provide a breakdown of the line of code in question, It would be very appreciated. 

Here is the link to the pdf I used as source for my code:https://www.maplesoft.com/applications/view.aspx?SID=154530

 

Hello, I am wondering if Maple is capable of generating a subgraph for a directed, weighed graph with the GraphTheory package. The online resources I can find only include undirected, unweighed graphs. 

can you please include an example with commands that is able to perform the said task?

Page 1 of 1