igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Things about ways to create ego-graph in python-igraph


From: Árpád Horváth
Subject: Re: [igraph] Things about ways to create ego-graph in python-igraph
Date: Wed, 3 Oct 2018 21:24:58 +0200

The code below gives the ego graph of vertex 0, if I'm right about
what is a ego graph is:

In [20]: g =igraph.Graph(7, [(0,1), (0,2), (0,3), (0,4), (4,5), (5,6)])

In [21]: g.neighbors(0)
Out[21]: [1, 2, 3, 4]

In [22]: vertices = g.neighbors(0) +[0]

In [23]: vertices
Out[23]: [1, 2, 3, 4, 0]

In [24]: ego = g.induced_subgraph(vertices)

In [26]: print(ego.summary(3))
IGRAPH U--- 5 4 --
+ edges:
0--1 0--2 0--3 0--4
Fan Yang <address@hidden> ezt írta (időpont: 2018. szept. 24., H, 12:32):
>
> Dear igraph developers,
> I am Fan.  I found ego_graph in NetworkX and make_ego_graph in igraph R which 
> are all applied to create the ego graph but I cannot find any functions in 
> python-igraph to deal with the ego graph. What should I do to create ego 
> graph in python-igraph?
>  I requested that issue on the github and then I obtained the answer that 
> "Using graph.neighborhood() with the appropriate parameterization, in 
> combination with graph.induced_subgraph()".
> But I am still quite confused about that since there is no such example in 
> igraph. Would it possible to provide me an example for that?
> I am looking forward to receiving your reply.
> Best,
> Fan
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help



reply via email to

[Prev in Thread] Current Thread [Next in Thread]