Our network (and many others) is normally a star-topology at the distribution layer (the switch here is the root of the spanning tree, and the router is connected to it).
Sometimes routers do not participate in spanning tree, in some places they do (and it's good practice to make them the root if you do)
Assumptions:
in most environments spanning tree is stable and you do not have frequent topology changes.
If your root is changing frequently then that is something to look at in any case -- perhaps watching the root bridge value and creating an event for root bridge change would be useful to some
in most cases the root switch is singular and it is key to the reachability of the child switches.
We make use of virtual stacks of switches for redundancy, but management-wise it appears to be one switch. In some highly redundant cases we have a dual-star topology; so being able to edit the dependencies for that case might be useful.
I'd like the dependency import/creation be able to auto-create dependencies where non-root switches depend on the root switch.
In my environment today this would create ~1000 dependencies
-------------------------
here is sample sql that leverages the data from a custom poller and the NCM inventory to build the relationships. you could use the interfaces table, but that requires the interface be monitored.
select distinct parentNode,childNode from
(SELECT ncp.CoreNodeID as parentNode,nci.MACAddress
FROM [NCM_Interfaces] NCI
inner join NCM_NodeProperties NCP on NCP.Nodeid=NCI.Nodeid
) Parent
inner join (
SELECT
cpa.nodeid as childNode
,replace(cps.Status,'.','') as macaddress
FROM [SolarWindsOrion].[dbo].[CustomPollerStatus] CPS
Inner join CustomPollerAssignment CPA
on cps.CustomPollerAssignmentID=cpa.CustomPollerAssignmentID
inner join CustomPollers CP on cpa.CustomPollerID=cp.CustomPollerID
and CP.UniqueName= 'dot1dBaseBridgeAddress' -- 1.3.6.1.2.1.17.1.1.0
and CPa.Status=1
) Child
on parent.MACAddress=child.macaddress
where parentNode<>childNode
order by parentNode