Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74645
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <phani.lav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.041 |
| X-Spam-Evidence | '*H*': 0.92; '*S*': 0.00; 'subject:Python': 0.06; 'scripting': 0.09; 'python': 0.11; 'def': 0.12; 'nodes):': 0.16; 'nodes.': 0.16; 'pairs': 0.16; 'trying': 0.19; 'later': 0.20; 'import': 0.22; 'print': 0.22; 'appreciated.': 0.29; 'message- id:@mail.gmail.com': 0.30; 'node': 0.31; 'file': 0.32; 'everyone': 0.33; 'skip:d 20': 0.34; 'knowledge': 0.35; 'common': 0.35; 'received:google.com': 0.35; 'subject:List': 0.36; 'thanks': 0.36; 'subject:New': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'read': 0.60; 'skip:n 30': 0.60; 'skip:\xc2 10': 0.60; 'new': 0.61; 'here': 0.66; 'ratio': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=PQLG7zCaNYq31iR0xBGgeT7ffS0yo7lAVTPK3s7RWIQ=; b=jHK8tTEd3tBkBggV5PCkN26AIbumEEYelsnLvEtfxLANFR+kBvFRcxTvgT+xeMDCA1 OZaHWEzAeOyJ3C94Q7w+FBB5uVhyQCbYicDBkBChagA34UW+kT6lsj1hmH0UOytn4ra1 wzap6B5cjdwMShzaalV1hXY0yyx2l8zKySJU+NMh+WvClV48URNSOSsYnM6xfsymJFD/ MyYIthmhusLGPBQN0iiaYEB6FUekifCruUlSrraziev8RPEtOdqQAHzkXKSSwHGWHxEZ HjcVlpplTPIMqoRRHs/7hzSdB6tmapFxjEBRbtGDGOrbIbJFQhqdkCGJwlTOv9/ghOTL w3UQ== |
| MIME-Version | 1.0 |
| X-Received | by 10.60.97.230 with SMTP id ed6mr5409257oeb.81.1405611580311; Thu, 17 Jul 2014 08:39:40 -0700 (PDT) |
| Date | Thu, 17 Jul 2014 17:39:40 +0200 |
| Subject | New to Python and Python mail List |
| From | lavanya addepalli <phani.lav@gmail.com> |
| To | python-list@python.org |
| Content-Type | multipart/alternative; boundary=089e0115f46eefcc7e04fe6572bb |
| X-Mailman-Approved-At | Thu, 17 Jul 2014 17:40:52 +0200 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.11930.1405611654.18130.python-list@python.org> (permalink) |
| Lines | 87 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1405611654 news.xs4all.nl 2957 [2001:888:2000:d::a6]:36792 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:74645 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hello Everyone
I am very much new to python scripting and i am here for knowledge
exchange.
I am trying to read a file with node pairs and weight.
I have to find the neighbours of each pair individual and combined
both also count them.
Later find the ratio of the neighbours that each node has. I am stuck
with finding nodes.
infile.txt
0_node1 0_node2 0w
1_node1 1_node2 1w
2_node1 2_node2 2w
3_node1 3_node2 3w
4_node1 4_node2 4w
import networkx as nx
import matplotlib.pyplot as plt
G=nx.Graph()
G = nx.read_edgelist('infile.txt', data=[("weight", float)])
def get_triangle(G):
for n1 in G.nodes:
neighbors1 = set(G[n1])
for n2 in filter(lambda x: x>n1, nodes):
neighbors2 = set(G[n2])
common = neighbors1 & neighbors2
for n3 in filter(lambda x: x>n2, common):
print n1
print n2
print n3
Any suggestion will be appreciated. Thanks
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
New to Python and Python mail List lavanya addepalli <phani.lav@gmail.com> - 2014-07-17 17:39 +0200
csiph-web