Sunday, 15 August 2010

r - Is it possible to use a metric (distance) unit in igraph cutoff argument? -


Newbie igraph users here I am trying to calculate the values ​​between every segment (edge) in the road network, I ideally want to limit the calculations so that only paths less than X meters can be considered. The igraph :: edge.betweenness.estimate function has a cutoff argument that makes it step ( turns ) But I would like to know that instead of using metric distance is possible.

So far I'm able to find the closest question is on Iigraph support, and it shows that this is not possible.

I am using my network aspatially, as a simple graph, but the road segment is a feature of length - LnkLength . It is possible to use the local network with IGraph (with the help of a local package) after reading the other stack overflow positions. If LNKLynth can be used as a load for the network, will it solve my problem?

If anyone has any ideas then I would be very grateful to hear them.

  data & lt; - data.frame (node ​​1 = AFactor (C (AA, AB, AC, AD, AE, Air Force, AG, AH, AI, AJ), node 2 = As.factor (c (BA, BB, BC, AA, AB, AC, BA, BB, BC, AA), LNKL & T = as.numeric (c (23.05, 42.81, 77.08, 39.63, 147.87, 56.46, 13.43, 25.53, 19 7.19, 34.9))) Data.graph & lt; - graph.data.frame (data, guided = wrong, upper = null) # 800m btw.trunc attempt to limit bissex estimate & lt; - shore (D.graph, e = E (d.graph), guided = false, cutoff = 20, weight = null)  

I'm thinking that in contrast to the current flow, you have to say the geodecic mean score (for example, uses a small edge of a small edge, calculates) (Which will treat the graph like the network of electrical resistor) I think a solution first is to achieve the matrix of the distance of all pairs A 'Distance' function should be used eg

DistMat = Distance (G, Weight = G $ LnkLength)

Now assume that you have a cutoff decute, then you (distmat> dCut)] = 0 (distmat, 'sparsematrix')

This will allow you to select those points Which points will allow you to select ...

  fromInds = Row (distMat) [which (! (Distif!) 0)] toinds = col (distmat) [which (! == 0)]  

Assume that there is no way roads and LNKline is not guided property, then you can only math Iks upper or lower triangle part or must consider. Since the 'Tunds' array will be automatically listed in ascending order, you can complete it only by successively and half the parts of the previous

  fromInds = fromIndnds [c (1: (Length if your graph is directed (like LnkLength is not in both directions or if it is not the same) (for example) are on the roads in a way) then you only get out of the event and even from the situation You are now looping on the index list and At least the text will be ready to specify the difference between the two digits by computing the path and returning to increase points between the appropriate path.  
  E G) $ betweenness = 0 (in iPair (1: length (ranging from)) {vpath = as.numeric (shortest_paths (g, weight = g $ lnkLength, output = "Vpath") $ vpath [[1] ]) # To change the list of path corners in the list of side paths, list path = C (1: (2 * length (Vpith) -1)) path list [C (1: length (V) Pat = 1)) * 2] = Vapeeth [C (2: length (Vpith))] Pat list [C (1: length (VPHIT-1)) * 2-1] = V = C (1: (Length (upstream-1))] meet the list. Ages (G, path list) #Instate eList e (g) $ middle of [ELIS] = e (g) $ beaches + 1}  

Now be assigned to its edges in your graph The property should be 'betweenness' using a geodesic matrix, which is calculated on the subset of path along the distance of less than 'decute'

If your graph is large, then the above version To parse RCPP may be worth it to port it Sector could take a long time otherwise. But this can be a completely insect ...


No comments:

Post a Comment