python-igraph manual

For using igraph from Python

   Home       Trees       Indices       Help   
Package igraph :: Package remote :: Module nexus :: Class NexusConnection
[hide private]

Class NexusConnection

source code

object --+
         |
        NexusConnection

Connection to a remote Nexus server.

In most cases, you will not have to instantiate this object, just use the global Nexus variable which is an instance of NexusConnection and connects to the Nexus repository at http://nexus.igraph.org.

Example:

>>> print Nexus.info("karate")            #doctest:+ELLIPSIS
Nexus dataset 'karate' (#1)
vertices/edges: 34/78
name: Zachary's karate club
tags: social network; undirected; weighted
...
>>> karate = Nexus.get("karate")
>>> from igraph import summary
>>> summary(karate)
IGRAPH UNW- 34 78 -- Zachary's karate club network
+ attr: Author (g), Citation (g), name (g), Faction (v), id (v), name (v), weight (e)
Instance Methods [hide private]
 
__init__(self, nexus_url=None)
Constructs a connection to a remote Nexus server.
source code
 
get(self, id)
Retrieves the dataset with the given ID from Nexus.
source code
 
info(self, id)
Retrieves informations about the dataset with the given numeric or string ID from Nexus.
source code
 
list(self, tags=None, operator='or', order='date')
Retrieves a list of datasets matching a set of tags from Nexus.
source code
 
search(self, query, order='date')
Retrieves a list of datasets matching a query string from Nexus.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
  url
Returns the root URL of the Nexus repository the connection is communicating with.

Inherited from object: __class__

Method Details [hide private]

__init__(self, nexus_url=None)
(Constructor)

source code 

Constructs a connection to a remote Nexus server.

Parameters:
  • nexus_url - the root URL of the remote server. Leave it at its default value (None) unless you have set up your own Nexus server and you want to connect to that. None fetches the URL from igraph's configuration file or uses the default URL if no URL is specified in the configuration file.
Overrides: object.__init__

get(self, id)

source code 

Retrieves the dataset with the given ID from Nexus.

Dataset IDs are formatted as follows: the name of a dataset on its own means that a single network should be returned if the dataset contains a single network, or multiple networks should be returned if the dataset contains multiple networks. When the name is followed by a dot and a network ID, only a single network will be returned: the one that has the given network ID. When the name is followed by a dot and a star, a dictionary mapping network IDs to networks will be returned even if the original dataset contains a single network only.

E.g., getting "karate" would return a single network since the Zachary karate club dataset contains one network only. Getting "karate.*" on the other hand would return a dictionary with one entry that contains the Zachary karate club network.

Parameters:
  • id - the ID of the dataset to retrieve.
Returns:
an instance of Graph (if a single graph has to be returned) or a dictionary mapping network IDs to instances of Graph.

info(self, id)

source code 

Retrieves informations about the dataset with the given numeric or string ID from Nexus.

Parameters:
  • id - the numeric or string ID of the dataset to retrieve.
Returns:
an instance of NexusDatasetInfo.

list(self, tags=None, operator='or', order='date')

source code 

Retrieves a list of datasets matching a set of tags from Nexus.

Parameters:
  • tags - the tags the returned datasets should have. None retrieves all the datasets, a single string retrieves datasets having that given tag. Multiple tags may also be specified as a list, tuple or any other iterable.
  • operator - when multiple tags are given, this argument specifies whether the retrieved datasets should match all the tags ("and") or any of them ("or").
  • order - the order of entries; it must be one of "date", "name" or "popularity".
Returns:
a NexusDatasetInfoList object, which basically acts like a list and yields NexusDatasetInfo objects. The list is populated lazily; i.e. the requests will be fired only when needed.

search(self, query, order='date')

source code 

Retrieves a list of datasets matching a query string from Nexus.

Parameters:
  • query - the query string. Searches are case insensitive and Nexus searches for complete words only. The special word OR can be used to find datasets that contain any of the given words (instead of all of them). Exact phrases must be enclosed in quotes in the search string. See the Nexus webpage for more information at http://nexus.igraph.org/web/docs#searching.
  • order - the order of entries; it must be one of "date", "name" or "popularity".
Returns:
a NexusDatasetInfoList object, which basically acts like a list and yields NexusDatasetInfo objects. The list is populated lazily; i.e. the requests will be fired only when needed.

Property Details [hide private]

url

Returns the root URL of the Nexus repository the connection is communicating with.

Get Method:
unreachable.url(self) - Returns the root URL of the Nexus repository the connection is communicating with.
Set Method:
unreachable.url(self, value) - Sets the root URL of the Nexus repository the connection is communicating with.

   Home       Trees       Indices       Help