11. Others…¶
- class pypgx.api.AllPaths(graph, java_all_paths)
The paths from one source vertex to all other vertices.
- destroy()
Destroy this object.
- get_path(destination)
Get the path.
- Parameters
destination – The destination node
- Returns
The path result to the destination node
- class pypgx.api.BipartiteGraph(session, java_graph)
A bipartite PgxGraph.
- get_is_left_property()
Get the ‘is Left’ vertex property of the graph.
- class pypgx.api.CompiledProgram(session, java_program)
A compiled Green-Marl program.
Constructor arguments: :param session: Pgx Session :param java_program: Java compiledProgram
- destroy()
Free resources on the server taken up by this Program.
- run(*argv)
Run the compiled program with the given parameters.
If the Green-Marl procedure of this compiled program looks like this: procedure pagerank(G: Graph, e double, max int, nodePorp){…}
- Parameters
argv – All the arguments required by specified procedure
- Returns
Result of analysis as an AnalysisResult as a dict
- class pypgx.api.GraphAlterationBuilder(java_graph_alteration_builder)
Builder to describe the alterations (graph schema modification) to perform to a graph.
It is for example possible to add or remove vertex and edge providers.
- class pypgx.api.MatrixFactorizationModel(graph, java_mfm, features)
Object that holds the state for repeatedly returning estimated ratings.
- get_estimated_ratings(v)
Return estimated ratings for a specific vertex.
- Parameters
v – The vertex to get estimated ratings for.
- Returns
The VertexProperty containing the estimated ratings.
- class pypgx.api.MergingStrategyBuilder(java_mutation_strategy_builder)
A class for defining a merging strategy on a graph.
- class pypgx.api.MutationStrategyBuilder(java_mutation_strategy_builder)
A class for defining a mutation strategy on a graph.
- class pypgx.api.Namespace(java_namespace)
Represents a namespace for objects (e.g. graphs, properties) in PGX
- class pypgx.api.Pgx(java_pgx_class)
Main entry point for PGX applications.
- create_session(source=None, base_url=None)
Create and return a session.
- Parameters
source – The session source string. Default value is “pgx_python”.
base_url – The base URL in the format host [ : port][ /path] of the PGX server REST end-point. If base_url is None, the default will be used which points to embedded PGX instance.
- get_instance(base_url=None, token=None)
Get a handle to a PGX instance.
- Parameters
base_url – The base URL in the format host [ : port][ /path] of the PGX server REST end-point. If base_url is None, the default will be used which points to embedded PGX instance.
token – The access token
- set_default_url(url)
Set the default base URL used by invocations of get_instance().
The new default URL affects sub-sequent calls of getInstance().
- Parameters
url – New URL
- class pypgx.api.PgxCollection(graph, java_collection)
Superclass for Pgx collections.
- add_all_elements(source)
Add elements to an existing collection.
- Parameters
source – Elements to add
- clone(name=None)
Clone and rename existing collection.
- Parameters
name – New name of the collection. If none, the old name is not changed.
- close()
Request destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.
- get_id()
Return the string representation of an internal identifier for this collection. Only meant for internal usage.
- Returns
a string representation of the internal identifier of this collection
- get_pgx_id()
Return an internal identifier for this collection. Only meant for internal usage.
- Returns
the internal identifier of this collection
- remove_all_elements(source)
Remove elements from an existing collection.
- Parameters
source – Elements to remove
- property size
Get the number of elements in this collection.
- to_mutable(name=None)
Create a mutable copy of an existing collection.
- Parameters
name – New name of the collection. If none, the old name is not changed.
- class pypgx.api.PgxEntity(graph, java_entity)
An abstraction of vertex and edge.
- get_property(property_name)
Get a property by name.
- Parameters
property_name – Property name
- set_property(property_name, value)
Set an entity property.
- Parameters
property_name – Property name
value – New value
- class pypgx.api.PgxMap(graph, java_map)
A map is a collection of key-value pairs.
- contains_key(key)
- Parameters
key – Key of the entry
- entries()
Return an entry set.
- get(key)
Get the entry with the specified key.
- Parameters
key – Key of the entry
- Returns
Value
- keys()
Return a key set.
- put(key, value)
Set the value for a key in the map specified by the given name.
- Parameters
key – Key of the entry
value – New value
- remove(key)
Remove the entry specified by the given key from the map with the given name.
Returns true if the map did contain an entry with the given key, false otherwise.
- Parameters
key – Key of the entry
- Returns
True if the map contained the key
- property size
Map size.
- class pypgx.api.PgxPath(graph, java_path)
- property edges
Return a list of edges in the path.
- property path
Return path as a list of (vertex,edge) tuples.
- property vertices
Return a list of vertices in the path.
- class pypgx.api.PickingStrategyBuilder(java_mutation_strategy_builder)
A class for defining a picking strategy on a graph.
- class pypgx.api.Scalar(graph, java_scalar)
A scalar value.
- destroy()
Free resources on the server taken up by this Scalar.
- get()
Get scalar value.
- set(value)
Set the scalar value.
- Parameters
value – Value to be assigned
- class pypgx.api.ScalarCollection(java_scalar_collection)
A collection of scalars.
- class pypgx.api.ScalarSequence(java_scalar_collection)
An ordered sequence of scalars which may contain duplicates.
- class pypgx.api.ScalarSet(java_scalar_collection)
An unordered set of scalars that does not contain duplicates.