apaGraph.NeighboursFromEdges(Edges, IsWeighted)
=apaGraph.NeighboursFromEdges(Edges, IsWeighted)Result
Returns the neighbours of each node of a graph defined by an edge list. Each row contains the number of neighbours, the neighbour indices and the edge weights to the neighbours.
Syntax
Edges: graph as an edge list, i.e. an n x 3 data matrix, the first two columns containing the node indices and the third column the distance between the two nodes
IsWeighted: TRUE to use the distance information, FALSE to assume unit distances
Remarks
Returns one row per node, from node 1 to the largest node index in Edges, and 1 + 2K columns, where K is the largest number of neighbours of any node. Column 1 contains the number of neighbours, columns 2 to K+1 the neighbour indices and columns K+2 to 2K+1 the corresponding edge weights (1 if IsWeighted is FALSE). Unused cells, e.g. for nodes with fewer than K neighbours or without any edge, show #N/A.
