LightJason - AgentSpeak(L++)
org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix Class Reference

creates from a graph the adjacency matrix. More...

+ Inheritance diagram for org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix:
+ Collaboration diagram for org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix:

Public Member Functions

final IFuzzyValue< Boolean > execute (final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
 defines a plan-body operation More...
 
final int minimalArgumentNumber ()
 minimum number of arguments More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.action.builtin.IBuiltinAction
final IPath name ()
 returns the name with path of the action More...
 
- Public Member Functions inherited from org.lightjason.agentspeak.action.IBaseAction
final boolean equals (final Object p_object)
 
final int hashCode ()
 
final String toString ()
 
- Public Member Functions inherited from org.lightjason.agentspeak.action.IAction
default Stream< IVariable<?> > variables ()
 returns a stream with all used variables More...
 

Static Private Member Functions

static Pair< DoubleMatrix2D, Collection<?> > apply ( @Nonnull final Graph< Object, Object > p_graph, @Nonnull final Map<?, Number > p_cost, final double p_defaultcost, @Nonnull final EType p_type)
 converts a graph into an adjacency matrix More...
 

Static Private Attributes

static final long serialVersionUID = -2499068539684263946L
 serial id More...
 

Additional Inherited Members

- Public Attributes inherited from org.lightjason.agentspeak.action.IAction
long serialVersionUID = -6374480398439703170L
 serial id More...
 
- Protected Member Functions inherited from org.lightjason.agentspeak.action.builtin.IBuiltinAction
 IBuiltinAction ()
 ctor More...
 
 IBuiltinAction (final int p_length)
 ctor More...
 
- Static Protected Attributes inherited from org.lightjason.agentspeak.action.builtin.IBuiltinAction
static final Logger LOGGER = CCommon.logger( IBuiltinAction.class )
 logger More...
 
- Static Protected Attributes inherited from org.lightjason.agentspeak.action.IBaseAction
static final Logger LOGGER = org.lightjason.agentspeak.common.CCommon.logger( IAction.class )
 logger More...
 

Detailed Description

The action converts graphs into a matrix, if a string is put on the argument list it must be "dense|sparse" to define the resulting matrix, a map defines the costs of an edge, a number defines the default costs, the ordering of the arguments is completly independed, for each graph two arguments will be returned, the adjacency matrix and the node names and the action never fails. The cost-map does not need an entry for each edge non-existing edges have got on default zero costs with 1

[M1|N1|M2|N2] = graph/adjacencymatrix( Graph1, "dense|sparse", Graph2 );
[M1|N1|M2|N2] = graph/adjacencymatrix( CostMap, Graph1, Graph2 );
[M1|N1|M2|N2] = graph/adjacencymatrix( Graph1, 1, Graph2 );
[M1|N1|M2|N2] = graph/adjacencymatrix( CostMap, Graph1, Graph2, "dense|sparse", );
See also
https://en.wikipedia.org/wiki/Adjacency_matrix

Definition at line 78 of file CAdjacencyMatrix.java.

Member Function Documentation

◆ apply()

static Pair<DoubleMatrix2D, Collection<?> > org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix.apply ( @Nonnull final Graph< Object, Object >  p_graph,
@Nonnull final Map<?, Number >  p_cost,
final double  p_defaultcost,
@Nonnull final EType  p_type 
)
staticprivate
Parameters
p_graphgraph
p_costmap with edges and costs
p_defaultcostdefault cost value (on non-existing map values)
p_typematrix type
Returns
pair of double matrix and vertices

Definition at line 143 of file CAdjacencyMatrix.java.

References org.lightjason.agentspeak.action.builtin.math.blas.IAlgebra.DENSEALGEBRA.

Referenced by org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix.execute().

+ Here is the caller graph for this function:

◆ execute()

final IFuzzyValue<Boolean> org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix.execute ( final boolean  p_parallel,
@Nonnull final IContext  p_context,
@Nonnull final List< ITerm p_argument,
@Nonnull final List< ITerm p_return 
)
Parameters
p_parallelparallel execution
p_contextcurrent execution context
p_argumentparameter of the action
p_returnreturn values
Returns
fuzzy boolean

Implements org.lightjason.agentspeak.language.execution.IExecution.

Definition at line 94 of file CAdjacencyMatrix.java.

References org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix.apply(), org.lightjason.agentspeak.language.CCommon.flatten(), org.lightjason.agentspeak.action.builtin.math.blas.EType.from(), org.lightjason.agentspeak.language.CRawTerm< T >.from(), org.lightjason.agentspeak.language.fuzzy.CFuzzyValue< T >.from(), org.lightjason.agentspeak.language.CCommon.rawvalueAssignableTo(), and org.lightjason.agentspeak.action.builtin.math.blas.EType.SPARSE.

Referenced by org.lightjason.agentspeak.action.builtin.TestCActionGraph.adjacencymatrix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ minimalArgumentNumber()

final int org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix.minimalArgumentNumber ( )
Returns
number of minimal arguments

Implements org.lightjason.agentspeak.action.IAction.

Definition at line 87 of file CAdjacencyMatrix.java.

Member Data Documentation

◆ serialVersionUID

final long org.lightjason.agentspeak.action.builtin.graph.CAdjacencyMatrix.serialVersionUID = -2499068539684263946L
staticprivate

Definition at line 83 of file CAdjacencyMatrix.java.