I'm trying to work out how to identify both the mean and median number of links attached to neighboring nodes when iterating through nodes A1
to B5
. Below I have an example matrix, given as matrixlist
, it's visualization, given as matrixvisualization
and the corresponding adjacency graph, graph
:
matrixlist = {{1, 1, 0, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 1, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 1, 0, 0, 0, 1}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 0, 0, 0, 0, 0, 1, 1}, {0, 1, 1, 0, 0, 0, 1, 0, 0, 1}, {1, 0, 0, 0, 0, 1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0, 1, 0, 1, 1, 0, 0, 0, 0}}matrixvisualization = MatrixForm[matrixlist, TableHeadings -> {{"A1", "A2", "A3", "A4", "A5", "B1", "B2", "B3", "B4", "B5"}, {"A1", "A2", "A3", "A4", "A5", "B1", "B2", "B3", "B4", "B5"}}]graph = AdjacencyGraph[verticeLabel, matrixlist, VertexLabels -> Placed["Name", Center], VertexSize -> .8, VertexStyle -> White]
I've included a picture of the graph to help with the explanation of what I'm trying to obtain. I would like to figure out how to find the mean number of links off neighboring nodes for each of the nodes present in the graph.
For example, in the graph provided, node A1
has two neighbors, A2
and B2
. A2
has a total of 4 links off of it and B2
has two links. Therefore, the mean number of links off neighboring nodes with respect to A1
is 3. Taking the same idea and applying it to the next node sequentially, A2
, the mean number of links off neighboring nodes with respect to A2
would be 3.25 (Loops are only counted as 1 additional link so A1
has 3 links in total). I would like to repeat this process for each node in the graph and then create a list which contains the averages.
meannewlist = {3, 3.25 ...}
Taking the same process above, I'm also trying to find out the medium number of links off neighboring nodes for each node. For example if we start at A1
, the median number of neighboring links with respect to A1
is 3 (coincidentally the same as its average number found above). As mentioned above, I would like to list all the median values in a list:
mediannewlist = {3, 3.25...}
Any insight as to how I might solve this would be greatly appreciated.