graph.knn() was renamed to knn() to create a more
consistent API.
Arguments
- graph
The input graph. It may be directed.
- vids
The vertices for which the calculation is performed. Normally it includes all vertices. Note, that if not all vertices are given here, then both ‘
knn’ and ‘knnk’ will be calculated based on the given vertices only.- mode
Character constant to indicate the type of neighbors to consider in directed graphs.
outconsiders out-neighbors,inconsiders in-neighbors andallignores edge directions.- neighbor.degree.mode
The type of degree to average in directed graphs.
outaverages out-degrees,inaverages in-degrees andallignores edge directions for the degree calculation.- weights
Weight vector. If the graph has a
weightedge attribute, then this is used by default. If this argument is given, then vertex strength (seestrength()) is used instead of vertex degree. But note thatknnkis still given in the function of the normal vertex degree. Weights are are used to calculate a weighted degree (also calledstrength()) instead of the degree.
