ptwobrussell / Mining-the-Social-Web-2nd-Edition

The official online compendium for Mining the Social Web, 2nd Edition (O'Reilly, 2013)
http://bit.ly/135dHfs
Other
2.9k stars 1.49k forks source link

Chapter 7 Example 5 doesn't compile #213

Closed ghost closed 10 years ago

ghost commented 10 years ago

The example 5 about constructing an ego graph of a repository and its stargazers doesn't work. I don't know how to fix it.

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-a2985856fde3> in <module>()
      6 
      7 g = nx.DiGraph()
----> 8 g.add_node(repo.name + '(repo)', type='repo', lang=repo.language, owner=user.login)
      9 
     10 for sg in stargazers:

NameError: name 'repo' is not defined
ghost commented 10 years ago

Oops, didn't see that I have to fill in access key. Did that, I don't see any output when I evaluate the cell with a Shift + Enter. What am I missing here? Thanks!

ptwobrussell commented 10 years ago

Which example? And which GitHub account/repo are you running against so I can be sure I am experiencing the same issue? I'll try to take a look and provide some help later today.

On Aug 17, 2014, at 11:17 AM, Sindhu S notifications@github.com wrote:

Oops, didn't see that I have to fill in access key. Did that, I don't see any output when I evaluate the cell with a Shift + Enter. What am I missing here? Thanks!

— Reply to this email directly or view it on GitHub.

ghost commented 10 years ago

@ptwobrussell Chapter 7 Example 5 about constructing an ego graph of a repository and its stargazers. I put in my access key and left the default username (yours) and repo (this repo).

ptwobrussell commented 10 years ago

Example 7-5 constructs the graph. You have to then run Example 7-6 to display some stats about it. Are you also running example 7-6? If so, you are getting some kind of output. Can you share it?

On Aug 17, 2014, at 11:29 AM, Sindhu S notifications@github.com wrote:

@ptwobrussell Chapter 7 Example 5 about constructing an ego graph of a repository and its stargazers. I put in my access key and left the default username (yours) and repo (this repo).

— Reply to this email directly or view it on GitHub.

ghost commented 10 years ago

I am not able to see any graph output from 7-5. Running example 7-6 though I receive a long output, first few lines here...


Name: 
Type: DiGraph
Number of nodes: 961
Number of edges: 960
Average in degree:   0.9990
Average out degree:   0.9990

{'lang': u'JavaScript', 'owner': u'ptwobrussell', 'type': 'repo'}
{'type': 'user'}

{'type': 'gazes'}

{u'Mining-the-Social-Web(repo)': {'type': 'gazes'}}
{}

[]
[('ptwobrussell(user)', u'Mining-the-Social-Web(repo)')]
ptwobrussell commented 10 years ago

Slight both examples are working as expected then. Did you have any additional questions?

On Aug 17, 2014, at 12:08 PM, Sindhu S notifications@github.com wrote:

I am not able to see any graph output from 7-5. Running example 7-6 though I receive a long output, first few lines here...

Name: Type: DiGraph Number of nodes: 961 Number of edges: 960 Average in degree: 0.9990 Average out degree: 0.9990

{'lang': u'JavaScript', 'owner': u'ptwobrussell', 'type': 'repo'} {'type': 'user'}

{'type': 'gazes'}

{u'Mining-the-Social-Web(repo)': {'type': 'gazes'}} {}

[] [('ptwobrussell(user)', u'Mining-the-Social-Web(repo)')] — Reply to this email directly or view it on GitHub.

ghost commented 10 years ago

What do you mean by "slight"? I am new to this and my question is, should example 7-5 be generating a graph? (a picture of a graph, something visual I mean)

ptwobrussell commented 10 years ago

Sorry, typo. Slight -> "sounds like"

Example 7-5 just constructs a data structure called a graph (which can later be rendered visually with a layout algorithm and visualization toolkit). Later examples display it's properties an manipulate it.

Are you following along with the book? Would be very helpful context if you are new to this.

ghost commented 10 years ago

Oh I see, thank you that makes sense. I haven't followed the book from the start but will do so, thank you. Closing this issue.

ptwobrussell commented 10 years ago

Sounds good. This particular chapter is written as an almost standalone primer on graph analysis, so if you follow along carefully, I think it will be very helpful to you.

If anything else comes up, please don't hesitate to reach back out

On Aug 17, 2014, at 1:00 PM, Sindhu S notifications@github.com wrote:

Oh I see, thank you that makes sense. I haven't followed the book from the start but will do so, thank you. Closing this issue.

— Reply to this email directly or view it on GitHub.

ghost commented 10 years ago

:+1: :)