addAsNeighbour = (edge, role, neighboursOfThisStep) => {
      allEdgesLeadingToNeighbours[edge.id] = edge;
      const tRef = this.getTiddlerById(edge[role]);

      if (
        view
        && utils.isTrue($tm.config.sys.nodeFilterNeighbours)
        && !utils.isMatch(tRef, neighFilter)) {
        return;
      }

      if (!visited[tRef]) {
        visited[tRef] = true;
        const node = this.makeNode(tRef, addProperties);
        if (node) { // saveguard against obsolete edges or other problems
          // record node
          allNeighbours[node.id] = node;
          neighboursOfThisStep.push(tRef);
        }
      }
    }
This function will return all neighbours of a graph denoted by
a set of tiddlers.

@todo parts of this code may be outsourced into a function to
prevent repeating code.

@param {Array<TiddlerReference>} matches - The original set that
    defines the starting point for the neighbourhood discovery
@param {Hashmap} [opts] - An optional options object.
@param {Hashmap} [opts.typeWL] - A whitelist lookup-table
   that restricts which edges are travelled to reach a neighbour.
@param {Hashmap} [opts.edges] - An initial set of edges that is
   used in the first step to reach immediate neighbours, if no
   set of edges is specified, all exsisting edges will be considered.
@param {number} [opts.steps] - An integer value that specifies
   the scope of the neighbourhood. A node is considered a neighbour
   if it can be reached within the given number of steps starting
   from original set of tiddlers returned by the node filter.
@param {Hashmap} [opts.addProperties] - a hashmap
    containing properties to be added to each node.
    For example:
    {
      group: 'g1',
      color: 'red'
    }
@return {Object} An object of the form:
    {
      nodes: { *all neighbouring nodes* },
      edges: { *all edges connected to neighbours* },
    }