formats/Graph.Format.ps1xml
<?xml version="1.0" encoding="utf-8" ?>
<Configuration> <Controls> <Control> <Name>Graph-Header</Name> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <ExpressionBinding> <ScriptBlock> if (-not $Env:PreludeHideFormatHeaders) { '' | Write-Color "Graph with {{#cyan $($_.Nodes.Count) Nodes}} and {{#cyan $($_.Edges.Count) Edges}}" | Write-Title -Template -DarkGray -Indent 2 } </ScriptBlock> </ExpressionBinding> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </Control> <Control> <Name>AdjacencyMatrix-Elements</Name> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <ExpressionBinding> <ScriptBlock> $AdjacencyMatrix = $_.AdjacencyMatrix $Values = $AdjacencyMatrix.Rows $MaximumLength = $AdjacencyMatrix.Indexes() | ForEach-Object { $Row, $Col = $_ ($Values[$Row][$Col] | Format-ComplexValue).Length } | Get-Maximum $Padding = [Math]::Max(3, $MaximumLength) $Values | ForEach-Object { $_ | ForEach-Object { $Color = if ($_ -eq 0) { 'DarkGray' } else { 'White' } "$(($_ | Format-ComplexValue).PadLeft($Padding + 1, ' '))" | Write-Color -Color $Color -NoNewLine } '' | Write-Color } </ScriptBlock> </ExpressionBinding> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </Control> </Controls> <ViewDefinitions> <View> <Name>Graph</Name> <ViewSelectedBy> <TypeName>Prelude.Graph</TypeName> </ViewSelectedBy> <CustomControl> <CustomEntries> <CustomEntry> <CustomItem> <Frame> <CustomItem> <ExpressionBinding> <CustomControlName>Graph-Header</CustomControlName> </ExpressionBinding> </CustomItem> </Frame> <Frame> <CustomItem> <ExpressionBinding> <CustomControlName>AdjacencyMatrix-Elements</CustomControlName> </ExpressionBinding> </CustomItem> </Frame> </CustomItem> </CustomEntry> </CustomEntries> </CustomControl> </View> </ViewDefinitions> </Configuration> |