<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Introduction
NetworKit provides an easy interface to Gephi that uses the Gephi graph streaming plugin. To be able to use it, install the Graph Streaming plugin using the Gephi plugin manager. Afterwards, open the Streaming window by selecting Windows/Streaming in the menu.
Workflow
Once the plugin is installed in gephi, create a new project and start the Master Server in the Streaming tab within gephi. The running server will be indicated by a green dot.
As an example, we generate a random graph...
Step1:  ... and export it directly export it into the active gephi workspace. After executing the following code, the graph should be available in the first gephi workspace. Attention
Step2:  Exporting node values
We now apply a community detection algorithm to the generated random graph and export the community as a node attribute to gephi. Any python list or Partition object can be exported. Please note that only the attribute itself is transfered, so make sure you called exportGraph(graph) first.
Step3:  The node attribute can now be selected and used in gephi, for partitioning or any other desired scenario.
Exporting edges scores
Just like node values, we can export edge values. After graph creation, each edge is assigned an integer id that is then used to access arbitrary attribute vectors, so any python list can be exported to gephi. In the following example, we assign an even number edge and export that score to gephi.
Step4:  Changing the server URL
By default, the streaming client in NetworKit connects to http
<ASSISTANT_TASK:>
Python Code:
G = generators.ErdosRenyiGenerator(300, 0.2).generate()
G.addEdge(0, 1) #We want to make sure this specific edge exists, for usage in an example later.
Explanation: Introduction
NetworKit provides an easy interface to Gephi that uses the Gephi graph streaming plugin. To be able to use it, install the Graph Streaming plugin using the Gephi plugin manager. Afterwards, open the Streaming window by selecting Windows/Streaming in the menu.
Workflow
Once the plugin is installed in gephi, create a new project and start the Master Server in the Streaming tab within gephi. The running server will be indicated by a green dot.
As an example, we generate a random graph...
End of explanation
client = gephi.streaming.GephiStreamingClient()
client.exportGraph(G)
Explanation: ... and export it directly export it into the active gephi workspace. After executing the following code, the graph should be available in the first gephi workspace. Attention: Any graph currently contained in that workspace will be overriden.
End of explanation
communities = community.detectCommunities(G)
client.exportNodeValues(G, communities, "community")
Explanation: Exporting node values
We now apply a community detection algorithm to the generated random graph and export the community as a node attribute to gephi. Any python list or Partition object can be exported. Please note that only the attribute itself is transfered, so make sure you called exportGraph(graph) first.
End of explanation
edgeScore = [2*x for x in range(0, G.upperEdgeIdBound())]
client.exportEdgeValues(G, edgeScore, "myEdgeScore")
Explanation: The node attribute can now be selected and used in gephi, for partitioning or any other desired scenario.
Exporting edges scores
Just like node values, we can export edge values. After graph creation, each edge is assigned an integer id that is then used to access arbitrary attribute vectors, so any python list can be exported to gephi. In the following example, we assign an even number edge and export that score to gephi.
End of explanation
client = gephi.streaming.GephiStreamingClient(url='http://localhost:8080/workspace0')
Explanation: Changing the server URL
By default, the streaming client in NetworKit connects to http://localhost:8080/workspace0, i.e. the first workspace of the local gephi instance. One might want to connect to a gephi instance running on a remote host or change the used port (this can be done in gephi by selecting Settings within the Streaming tab). To change the url in NetworKit, simply pass it upon the creation of the client object:
End of explanation
<END_TASK>