Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alexplatasl/dplbnde/llms.txt

Use this file to discover all available pages before exploring further.

Every algorithm in dplbnDE accepts an edgelist argument that overrides the automatically learned structure. This lets you encode domain knowledge or test specific topologies.

Defining an edge list

An edge list is a matrix or data frame with exactly 2 columns: from and to, each row specifying a directed edge.
my_structure <- matrix(c(
  "class",    "buying",
  "class",    "maint",
  "class",    "doors",
  "class",    "persons",
  "class",    "lug_boot",
  "class",    "safety",
  "maint",    "buying",
  "lug_boot", "safety"
), ncol = 2, byrow = TRUE)

Running with a custom structure

Pass the matrix to any algorithm via edgelist. The structure argument is still used as a base for initialization but is replaced by your edge list:
library(dplbnDE)
data(car)

run.shade <- lshade(
  NP = 40, G = 25,
  data = car,
  class.name = names(car)[7],
  c = 0.1, pB = 0.05,
  edgelist = my_structure,
  verbose = 5
)
Because lshade uses Linear Population Size Reduction (LPSR), the population shrinks each generation. Example output:
Gen:  5 	 CLL=  -1616.161 	 NP=  24
Gen:  10 	 CLL=  -1229.425 	 NP=  20
Gen:  15 	 CLL=  -1161.089 	 NP=  17
Gen:  20 	 CLL=  -1076.062 	 NP=  14
Gen:  25 	 CLL=  -1022.326 	 NP=  12

Requirements for a valid edge list

Violating these rules will cause an error.
  • Must be a matrix or data frame with exactly 2 columns
  • The class variable name must appear as a node in the edge list
  • All node names must match column names in your data frame
  • The graph must be a valid DAG (no cycles)

Using a data frame

You can also pass a data frame with named columns:
edges_df <- data.frame(
  from = c("class", "class", "maint"),
  to   = c("buying", "maint", "buying"),
  stringsAsFactors = FALSE
)

result <- DEbest(NP=20, G=25, data=car, class.name="class",
                 structure="nb", edgelist=edges_df, verbose=5)

Build docs developers (and LLMs) love