Ok, attached is the script and the data file. Thanks very much!
-Ahmed
On Tue, Aug 11, 2015 at 3:35 PM, Tamas Nepusz <[email protected]> wrote:
> > Any idea what the error is about?
> Hard to tell; please send us a short, self-contained example that
> reproduces
> the issue.
>
> T.
>
> _______________________________________________
> igraph-help mailing list
> [email protected]
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>
#!/usr/local/bin/python
import csv
import igraph
import math
from igraph import *
from itertools import chain
#("ftn-weighted-network.csv")
reader = csv.DictReader(open("bigrams-ground-truth.csv"), dialect="excel")#("bigrams-ground-truth.csv")
g = igraph.Graph.DictList(vertices=None, edges=reader, directed=True)
g.simplify()
#g.to_directed()
#print g.vs["name"]
pr = g.pagerank()
layout = g.layout_random()
visual_style = {}
visual_style["vertex_size"] = [float(15 *pr[v.index]) for v in g.vs]
visual_style["vertex_label"] = g.vs["name"]
visual_style["edge_color"] = 'red' #darkolivegreen4
visual_style["vertex_label_color"] = 'darkslateblue'
visual_style["vertex_label_size"] = 5
visual_style["vertex_label_dist"] = 1.5
visual_style["edge_length"] = 20
#visual_style["edge_width"] = .10# g.es["weight"] # [float(x) for x in g.es["weight"]]
#visual_style["edge_width"] = 30#[.07+10 *float(x) for x in g.es["weight"]]
visual_style["edge_arrow_size"] = .01
visual_style["layout"] = layout
visual_style["bbox"] = (800, 800)
visual_style["margin"] = 20
plot(g ,**visual_style)
plot(g, "/Users/ahamed/Publications/CICLing-Egypt/ftn-weighted-network.pdf", **visual_style)
#g.vs["label"] = g.vs["name"]
#print g.vcount()
#print g.ecount()
#pr = g.pagerank()
#for v in g.vs:
# print "{0}, {1}, {2}".format(v["name"], v.degree(), (pr[v.index]))
'''
rankLogs = []
for r in pr :
print r
rankLogs.append(math.log(r))
#print len(pr)
#bins = range(1, 2)
#plt.xticks(bins, ["2^%s" % i for i in bins])
#n, bins, patches = plt.hist(rankLogs, log=True)
#plt.xlabel('PageRank Value')
#plt.ylabel('Frequency')
#plt.title('Histogram of Term PageRanks')
#plt.text(60, .025, r'$\mu=100,\ \sigma=15$')
#plt.yticks(np.arange(0, 250, 10))
#plt.xticks(np.arange(min(pr), max(pr)+1, .01))
#plt.axis([0, 2.5, 1, 1000])
#plt.grid(True)
#plt.show()
# print ("Node" + "," + "Degree" + "," + "Eccentricity" + "," + "Closeness" + "," + "Betweennness")
# for v in g.vs:
# print (str(v["name"]) + "," + str(v.degree()) + "," + str(v.pagerank()) +"," + str(v.closeness()) + "," + str(v.betweenness()))
layout = g.layout_random()
visual_style = {}
visual_style["vertex_size"] = 1
#visual_style["vertex_color"] = [color_dict[gender] for gender in g.vs["gender"]]
visual_style["vertex_label"] = g.vs["name"]
visual_style["edge_width"] = [1]
visual_style["layout"] = layout
visual_style["bbox"] = (1200, 1200)
visual_style["margin"] = 20
plot(g, **visual_style)
g.vs
'''
'''
#plot(g, layout = layout)
'''
source,target
global,warming
target,power
power,plants
climate,science
climate,change
global,ocean
ocean,warming
2008,cooling
2020,emissions
sustainable,future
fight,climate
blind,spot
solar,power
challenging,political
political,climate
cloudy,picture
coastal,escape
coastal,real
climate,risk
carbon,offsets
weather,extremes
fight,global
global,assessment
climate,policy
global,perspective
human,perspective
coastal,adaptation
sea,level
level,rise
warming,world
extreme,rainfall
public,response
climate,engineering
record,year
systems,approach
climate,pact
food,safety
ocean,fisheries
drive,species
ice,loss
world,food
extreme,heat
climate,risks
climate,justice
conservation,measures
global,forest
forest,carbon
carbon,balance
flood,risk
challenging,climate
carbon,budget
climategate,inquiry
past,revealed
sea,ice
marine,invaders
consensus,prediction
summer,heat
dry,southern
aerosols,impacts
cool,polar
summer,extremes
rain,shift
biomass,burning
burning,black
ocean,acidification
carbon,feedbacks
snow,albedo
change,communication
emissions,gap
cities,resilience
change,impact
impact,adaptation
political,action
ice,takes
climate,scientist
green,shift
global,change
capture,vital
carbon,sink
ocean,carbon
dioxide,fertilization
storage,deep
change,warning
emissions,timing
ocean,heat
warming,projections
impact,assessment
food,security
dangerous,climate
health,agricultural
energy,research
heating,seas
complex,response
warming,attribution
carbon,emissions
forest,disturbances
carbon,storage
meeting,temperature
natural,hazards
data,hack
polar,bears
climate,tipping
ecosystem,shifts
biodiversity,conservation
extinction,risk
treering,gap
export,carbon
rising,costs
summer,climate
fish,behaviour
climate,variability
tropical,tree
rising,temperature
climate,forecasts
change,adaptation
heat,effects
summer,weather
solar,climate
forest,biomass
carbons,fate
climate,adaptation
change,science
coastal,cities
lake,warming
summer,sea
change,mitigation
health,effects
versus,warming
longterm,human
human,migration
change,revealed
weather,forecast
permafrost,carbon
climate,warming
carbon,dioxide
dioxide,sink
future,climate
sustainable,building
days,ahead
climate,story
warm,days
days,increase
global,climate
human,water
volcanic,forcing
agricultural,adaptation
emissions,transfers
temperature,variability
change,experiments
tropical,marine
carbon,footprint
climate,game
glacier,melt
ice,melting
poor,energy
energy,policy
hockey,sticks
rainfall,extremes
soil,food
carbon,capture
albedo,engineering
energy,efficiency
regional,climate
global,temperature
temperature,record
soil,carbon
glacier,variability
carbon,mystery
policy,benefits
mitigation,targets
glacier,response
carbon,price
treering,record
climate,models
summer,monsoon
future,atmospheric
species,shift
acidification,costs
temperature,trends
political,impacts
summer,warming
bears,disappear
carbon,market
challenging,future
regional,emissions
global,policy
forest,conservation
growing,footprint
ocean,temperature
ice,models
future,bioenergy
forest,bioenergy
temperature,versus
increase,energy
drought,effects
coastal,aquifers
climate,research
reef,fish
energy,futures
greenhouse,warming
climate,fix
sea,rise
temperature,extremes
climate,extremes
launches,geoengineering
sustainable,development
emissions,trends
growing,climate
climate,divide
tropical,forest
global,carbon
solar,impacts
community,shift
soft,corals
treering,climate
atmospheric,energy
emissions,cuts
ocean,fertilization
weather,ahead
climate,impacts
global,tropical
water,cycle
missing,climate
science,message
missing,greenhouse
greenhouse,gas
ocean,conservation
dioxide,world
nuclear,paradox
change,risks
coastal,plant
polar,temperature
temperature,amplification
global,environmental
environmental,change
temperature,response
past,tipping
climate,report
ocean,conference
cloud,forest
electricity,supply
warm,temperature
peat,dry
climate,projections
2008,conference
years,updated
risk,research
glaciers,recede
conference,water
regional,weather
regional,response
energy,revolution
future,sea
marine,ecosystem
global,biodiversity
ice,time
science,agency
ozone,forcing
wrong,tree
reef,calcium
community,level
ecological,feedbacks
hot,water
temperature,drive
mitigating,global
global,greenhouse
gas,emissions
human,health
ecological,engineering
natural,variability
versus,moral
climate,effects
media,matters
inquiry,science
biodiversity,loss
change,impacts
financing,climate
change,action
soil,nitrogen
plant,biomass
2010,global
dioxide,emissions
energy,budget
climate,geoengineering
dioxide,storage
glacier,status
fossil,fuel
tropical,cyclones
history,dont
technology,transfer
complex,food
rain,forest
health,risks
fire,emissions
agricultural,carbon
nuclear,power
temperature,effects
tropical,warming
peak,temperature
human,decisionmaking
adaptation,assessment
adaptation,policy
2020,vision
climate,deal
tropical,forests
temperature,trend
reef,corals
ecological,benefits
temperature,change
carbon,projections
launches,climate
policy,progress
ecosystem,carbon
history,revealed
warming,heat
change,research
social,science
launches,position
shipping,emissions
global,oil
global,species
coastal,flooding
climate,mitigation
short,supply
long,shadow
glacier,loss
temperature,peak
flood,disturbance
ecosystem,evolution
action,film
biofuels,sustainable
ecology,behaviour
conservation,adaptation
climate,protection
climate,data
capital,accounting
forest,phenology
climate,record
record,back
oceans,agency
hot,temperature
talk,energy
energy,assessing
key,science
treering,data
summer,temperature
temperature,projections
green,behaviour
methane,emissions
reef,biogeochemistry
human,development
global,food
road,ahead
climate,views
policy,support
early,climate
energy,balance
2008,2009
2009,global
ice,retreat
extreme,summer
tropical,reef
_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help