Gephi Lite: Custom Filter

Aus MediaeWiki
Zur Navigation springen Zur Suche springen

Konzept

Wenn Sie in Gephi Lite einen Knoten testweise herausfiltern wollen, können Sie den folgenden Code als Custom Filter eingeben:

/**

* Filtering function.

*

* @param {string} id ID of the item

* @param {Object.<string, number | string | boolean | undefined | null>} attributes Attributes of the item

* @param {FullGraph} full graph (data and rendering attributes + topology) dataset

* @return {boolean} TRUE if the item should be kept in the graph, FALSE to filter it

*/

function nodeFilter(id, attributes, graph) {

  // Überprüfe, ob der Knoten den Namen "ROLLENNAME" hat

  if (attributes.label === "ROLLENNAME") {

    return false; // Der Knoten wird herausgefiltert

  }

  return true; // Alle anderen Knoten bleiben im Graphen

}

Beispiel: Joseph

Um die Rolle des Joseph aus einem Netzwerk herauszufiltern, können Sie den folgenden Code verwenden:

/**

* Filtering function.

*

* @param {string} id ID of the item

* @param {Object.<string, number | string | boolean | undefined | null>} attributes Attributes of the item

* @param {FullGraph} full graph (data and rendering attributes + topology) dataset

* @return {boolean} TRUE if the item should be kept in the graph, FALSE to filter it

*/

function nodeFilter(id, attributes, graph) {

  // Überprüfe, ob der Knoten den Namen "Joseph" hat

  if (attributes.label === "Joseph") {

    return false; // Der Knoten wird herausgefiltert

  }

  return true; // Alle anderen Knoten bleiben im Graphen

}