[Networkit] Graph

Christian Staudt christian.staudt at kit.edu
Sat Apr 25 10:18:36 CEST 2015


Hi Subbu,

you almost had it, the method is called “Graph.neighbors”, which can be found in the module documentation: https://networkit.iti.kit.edu/documentation/

Consider this piece of code:

from networkit import *
import itertools

def connectionsAmongNeighborsOf(u, G):
	connected = set([(v, w) for (v, w) in itertools.combinations(G.neighbors(u), 2) if G.hasEdge(v, w)])
	return connected

Best,
Christian


On 25 Apr 2015, at 00:59, Subramanian Iyer <sriyer at unm.edu> wrote:

> Hi Henning,
> 
> I am looking for methods that allow me to query the graph around a specific node. For the example I gave, pseudocode would be:
> 
> connected = {}
> neighbors = G.getNeighbors(node=1)
> for node1 in neighbors:
>    for node2 in neighbors:
>        if node1 != node2:
>            connected[str(node1) + ' - ' str(node2)] = G.hasEdge(node1, node2)
> 
> I don't know what the NetworKit function corresponding to GetNeighbors is.
> 
> It would also be helpful if you could point me to the documentation of where I should look up this information. Right now the documentation I am looking at are the example ipython notebooks.
> 
> Subbu
> 
> 
> ________________________________________
> From: Henning Meyerhenke <meyerhenke at kit.edu>
> Sent: Friday, April 24, 2015 1:12 PM
> To: Subramanian Iyer
> Cc: networkit at ira.uni-karlsruhe.de
> Subject: Re: [Networkit] Graph
> 
> Hi Subbu,
> 
> Could you please rephrase your post as a more concrete question? Would
> you like to know how to construct the network or how to invoke the
> methods for structural analysis?
> 
> Best,
> Henning
> 
> 
> Am 24.04.15 um 18:57 schrieb Subramanian Iyer:
>> Hi,
>> 
>> 
>> I would like to create a network graph focused on one node in an
>> edgelist. Let me call that node N1. The graph should contain the
>> following -
>> 
>> 1. The connections that N1 has.
>> 
>> 2. Suppose N1 is connected to N2 through N15. The connections of N2-N15.
>> I would like to see whether any second level connections of N1 i.e.,
>> N2 through N15 are connected to each other.  In other words I would like
>> to see whether N2 is connected to N8 or whether N5 is connected N10.
>> 
>> 
>> Subbu
>> 
>> 
>> 
> 
> --
> 
> =======================================================
> Karlsruhe Institute of Technology (KIT)
> Institute of Theoretical Informatics (ITI)
> 
> Juniorprof. Dr. Henning Meyerhenke
> Theoret. Informatics / Parallel Computing
> 
> Phone: +49-721-608-41876
> Web: http://parco.iti.kit.edu/henningm/
> 
> KIT - University of the State of Baden-Wuerttemberg and
> National Research Center of the Helmholtz Association
> =======================================================
> 
> 
> _______________________________________________
> NetworKit mailing list
> NetworKit at ira.uni-karlsruhe.de
> https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20150425/65a37e02/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20150425/65a37e02/attachment-0001.sig>


More information about the NetworKit mailing list